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.

Get this working properly with React Router

See original GitHub issue

There is a hacky workaround in https://github.com/gaearon/react-hot-boilerplate/pull/61#issuecomment-211504531 but it’s way too hacky. We should either implement this in https://github.com/reactjs/react-router/issues/2182, or include some sort of hacky workaround right in this project so at least it’s on us. Special casing React Router doesn’t sound very great but it’s hugely popular and we can’t just not support it.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:46 (13 by maintainers)

github_iconTop GitHub Comments

64reactions
jaredpalmercommented, Apr 26, 2016

@gaearon This may be a hack, but passing Router a random key seems to work fine.

// Root.js
import React, { Component } from 'react';
import { Provider } from 'react-redux'
import { browserHistory, Router} from 'react-router'
import configureStore from './store/configureStore'
import routes from './routes'

export default class Root extends Component {
  render() {
    const store = configureStore()
    return (
      <Provider store={store}>
        <Router history={browserHistory} routes={routes} key={Math.random()}/>
      </Provider>
    );
  }
}

16reactions
yyankovblccommented, Mar 2, 2017

We still reproduce the issue with react-router and redux, in the console we have WDS] App hot update... dev-server.js?05e4:45 [HMR] Checking for updates on the server... log-apply-result.js?e2ce:20 [HMR] Updated modules: log-apply-result.js?e2ce:22 [HMR] - ./components/Login/LoginForm.tsx log-apply-result.js?e2ce:22 [HMR] - ./components/Login/LoginModal.tsx log-apply-result.js?e2ce:22 [HMR] - ./containers/App/index.tsx log-apply-result.js?e2ce:22 [HMR] - ./containers/AppComponent/index.tsx dev-server.js?05e4:27 [HMR] App is up to date. but browser doesn’t re-render anything?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Handle Routing in React Apps with React Router
React Router lets you split out child routes directly in the component, which means you don't need to have the whole list in...
Read more >
Tutorial v6.6.1 - React Router
First thing to do is create a Browser Router and configure our first route. This will enable client side routing for our web...
Read more >
React router dom navigate method is not working properly
1 Answer 1 · useLocation hook to grab the current location user is attempting to access. · Outlet component for nested protected routes....
Read more >
React Router DOM: How to handle routing in web apps
React Router DOM contains the DOM bindings for React Router. Learn about its essential components and how to build routes with parameters.
Read more >
React Router 6 – Tutorial for Beginners - YouTube
Learn how to use React Router V6 in this crash course for beginners. React Router is the most popular way to add page...
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