question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Router Switch Support

See original GitHub issue

Hey 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:45 (28 by maintainers)

github_iconTop GitHub Comments

2reactions
dawidvdhcommented, Aug 11, 2017

@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!

2reactions
dawidvdhcommented, Aug 4, 2017

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found