Spectrum is now read-only. Learn more about the decision in our official announcement.


A community of developers who use Redux. This community is a great place to ask questions and talk all about Redux.


Routing in React / Redux

April 2, 2020 at 6:12pm

Routing in React / Redux

April 2, 2020 at 6:12pm (Edited 2 years ago)
I'm working on a larger application at work. ...walked into this setup and I'm learning redux along with this large codebase. Anyway, my first user story out the gates has me inspecting component X that isn't re-rendering after a state change...a user has to refresh the page before an update. Key Point - a user makes changes in component Y which update state, then they click to a new route where component X doesn't update...
I'll spare all the details here initially, but I ended up writing a check inside component X's componentDidMount() for a state variable (if updated === true, then...update the component data). This all works fine. Problem solved....maybe.
Isn't this the whole point of routing and redux? I feel like the initial routing is setup incorrectly. Routing in the application obviously works for normal route changes, however, none of the other route changes replicate the scenario I described above.
So here's the setup that I can't determine if there's something wrong. I followed some setup guides and it all looks okay, but the behavior in the App doesn't seem okay:
Root.js wraps the App.
Root.js: `<Provider store={store}> <PersistGate loading={null} persistor={persistor}> <ConnectedRouter history={history}>{props.children}</ConnectedRouter> </PersistGate> </Provider>`
Any thoughts, look here next, or general discussion appreciated. Thanks!
No messages yet