React Router Switch Support
See original GitHub issueHey love this whole set up you have created, I am just stuck with one thing though and thats using react router, My set up is heavily inspired by flush-chunks-boilerplate-webpack-chunknames almost exactly the same, however when i make use of react router and i receive a failed checksum from server to client markup:
(client) bout!</a></nav><div data-reactid="6">Loa
(server) bout!</a></nav><div id="home" data-react
It seems that the server renders it just fine but then the client reloads it? I havent done a very deep dive yet but was wondering if there were known issues with react router?
I use react-router in the following way:
The main App:
const Home = universal(() => import('./Home'), {
resolve: () => require.resolveWeak('./Home'),
chunkName: 'Home'
})
const App = () => (
<div>
<Helmet {...config.head} />
<Menu />
<Switch>
<Route path="/" component={Home} exact />
<Route path="/about" component={About} exact />
<Route component={NotFound} exact />
</Switch>
</div>
)
Client:
render(
<AppContainer>
<Provider store={store} key="provider">
<BrowserRouter forceRefresh={!supportsHistory}>
<App />
</BrowserRouter>
</Provider>
</AppContainer>,
document.getElementById('root')
)
Server:
const component = (
<Provider store={store} key="provider">
<StaticRouter
location={req.url}
context={reactRouterContext}
>
<App />
</StaticRouter>
</Provider>
)
Any Help would be Greatly Appreciated.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:45 (28 by maintainers)
Top Results From Across the Web
Switch - React Router: Declarative Routing for React.js
<Switch> is unique in that it renders a route exclusively. In contrast, every <Route> that matches the location renders inclusively. Consider these routes:...
Read more >Upgrading from v5 v6.6.1 - React Router
Upgrade to React Router v5.1. It will be easier to make the switch to React Router v6 if you upgrade to v5.1 first....
Read more >Primary Components - React Router v5
There are three primary categories of components in React Router: routers, like <BrowserRouter> and <HashRouter>; route matchers, like <Route> and <Switch> ...
Read more >useHistory hook - React Router: Declarative Routing for React.js
React Router ships with a few hooks that let you access the state of the router and perform navigation from inside your components....
Read more >React Router: Home v6.6.1
I'm New. Start with the tutorial. It will quickly introduce you to the primary features of React Router: from configuring routes, to loading...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@faceyspacey as promised our boilerplate https://github.com/madeagency/reactivity still working on the documentation, fixing up our code climate score and of course any and all pull requests are super welcome, Let us know what you think!
Hey @faceyspacey i would be super keen. I’ll even do you one better, myself and a few people have been developing a boilerplate for power users that use your tools extensively… we’ll probably be releasing within the next week, I will let you know as soon as its up!