diff --git a/docs/Snippets.md b/docs/Snippets.md index 135e201..7eed65a 100644 --- a/docs/Snippets.md +++ b/docs/Snippets.md @@ -59,6 +59,7 @@ I.E. `tsrcc` | `imbrc→` | `import { Route, Switch, NavLink, Link } from react-router-dom'` | | `imbrr→` | `import { Route } from 'react-router-dom'` | | `imbrs→` | `import { Switch } from 'react-router-dom'` | +| `imbrx→` | `import { Routes, Route } from 'react-router-dom'` | | `imbrl→` | `import { Link } from 'react-router-dom'` | | `imbrnl→` | `import { NavLink } from 'react-router-dom'` | | `imrs→` | `import React, { useState } from 'react'` | diff --git a/src/snippets/generated.json b/src/snippets/generated.json index d73bea5..a7933e2 100644 --- a/src/snippets/generated.json +++ b/src/snippets/generated.json @@ -962,6 +962,12 @@ "prefix": "imbrs", "body": ["import { Switch } from 'react-router-dom'"], "scope": "typescript,typescriptreact,javascript,javascriptreact" + }, + "importRoutes": { + "key": "importRoutes", + "prefix": "imbrx", + "body": ["import { Routes, Route } from 'react-router-dom'"], + "scope": "typescript,typescriptreact,javascript,javascriptreact" }, "import": { "key": "import", diff --git a/src/sourceSnippets/imports.ts b/src/sourceSnippets/imports.ts index f28281b..d88b9e9 100644 --- a/src/sourceSnippets/imports.ts +++ b/src/sourceSnippets/imports.ts @@ -24,6 +24,7 @@ type ImportsMappings = { importRouterNavLink: 'imbrnl'; importRouterSetup: 'imbrc'; importRouterSwitch: 'imbrs'; + importRoutes:'imbrx' }; export type ImportsSnippet = SnippetMapping; @@ -123,7 +124,11 @@ const importRouterSwitch: ImportsSnippet = { prefix: 'imbrs', body: ["import { Switch } from 'react-router-dom'"], }; - +const importRoutes: ImportsSnippet = { + key: 'importRoutes', + prefix: 'imbrx', + body: ["import { Routes, Route } from 'react-router-dom'"], +}; const importRouterLink: ImportsSnippet = { key: 'importRouterLink', prefix: 'imbrl', @@ -177,6 +182,7 @@ const importAs: ImportsSnippet = { }; export default [ + importRoutes, importAs, importBrowserRouter, importBrowserRouterWithRouteAndNavLink,