Closed Jaouan closed 5 months ago
Hey @Jaouan, thanks for your message and submitting this PR.
Tbh I don't see the need to export HashRoutes
or MemoryRoutes
as the routes
object (not Routes
component) was exported for this customization purpose. The default app entry with the default browser Routes
looks like that:
import { createRoot } from 'react-dom/client'
import { Routes } from '@generouted/react-router'
const container = document.getElementById('app')!
createRoot(container).render(<Routes />)
In order to use HashRouter
with the current exports, it would be exactly the same as what you exported in this PR:
import { createRoot } from 'react-dom/client'
import { RouterProvider, createHashRouter } from 'react-router-dom'
import { routes } from '@generouted/react-router'
const Routes = () => <RouterProvider router={createHashRouter(routes)} />
const container = document.getElementById('app')!
createRoot(container).render(<Routes />)
I think we can close this PR, and I'm thinking to include this point in a (new) FAQ section on the docs.
Hi, I forgot that βroutesβ is also exported. π«£ Your example is enough to handle memory/hash routing. π
No worries, glad that helped!
Hey! π
First of all, thank you for this library, which is an interesting and enjoyable accelerator to use.
On one of my projects using react-router, I needed to use memory-routing (via
createMemoryRouter
). Unfortunately, it didn't seem possible with Generouted. Here's a PR that adds<HashRoutes />
and<MemoryRoutes />
to the react-router implementation.If you see any adjustments that need to be made, I'll be happy to do them. π«‘
Have a great day βοΈ