Replies: 1 comment 2 replies
-
Your routes are just an array so you can spread + let router = createBrowserRouter([
...['/german-url', '/english-url'].map(path => ({
path,
Component: MyRouteComponent
})
]);
I'm not sure I understand what you mean here? You still had double the number of routes in your |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the preferred way since v6.4 to have multiple paths pointing to the same component.
My application has different urls depending on the language. I want to avoid having double the amount of routes.
With v6 I could do something like this:
`const App = () =>
useRoutes(['/german-url', '/english-url'].map(path => ({path, element})));
const AppWrapper = () => (
);`
How would I do this with createBrowserRouter?
Beta Was this translation helpful? Give feedback.
All reactions