remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
53k stars 10.3k forks source link

Components which is created with `connect` from ReactRedux breaks behavior of router #4936

Closed uaNikita closed 7 years ago

uaNikita commented 7 years ago

Version

4.0.0

Test Case

https://codepen.io/anon/pen/QpXYJB

Steps to reproduce

Click to the Home and About link nothing happen. Then change LayoutConnect in App to Layout and click again - text is changing.

Expected Behavior

LayoutConnect and Layout work the same way.

Actual Behavior

LayoutConnect which is created with connect from ReactRedux breaks behavior. Links does not work.

pshrmn commented 7 years ago

Your connected component is blocking updates. Please see this guide for more information https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/blocked-updates.md

jcreamer898 commented 7 years ago

I'm having a ridiculously hard time getting this right ATM, so if there's an example of someone hooking up connect with react-router, I'd be super happy. :)

damianobarbati commented 7 years ago

@jcreamer898 I'm loosing countless hours of work because of this bug, not able to have withRoute working. Did you find any solution?

jcreamer898 commented 7 years ago

Yeah, I'll throw up an example of how I solved it. Gimme' a sec.

jcreamer898 commented 7 years ago

https://github.com/lonelyplanet/react-universal-starter/blob/master/app/universal/containers/universal.jsx#L30

damianobarbati commented 7 years ago

Great, solved! The problem was I had to use withRouter only in my main component rendering children!

jcreamer898 commented 7 years ago

Nice!