Reputation: 36299
Is it possible to have an internal route system so that components render, but the main browser route doesn't change?
So if you start with mysite.com
it renders a list page, you can go into an instance page, but the url remains at mysite.com
, and so on. If you refresh the page, it will go back to the list page.
Upvotes: 1
Views: 1396
Reputation: 2764
You can use the MemoryRouter
instead of the Router
for this. For examples and documentation see https://reacttraining.com/react-router/web/api/MemoryRouter
For react-router version 3 you can import createMemoryHistory
from history
const memoryHistory = createMemoryHistory(location);
<Router history={memoryHistory} routes={routes} />
Version 3 docs: https://github.com/ReactTraining/react-router/blob/v3/docs/guides/Histories.md#creatememoryhistory
Upvotes: 2