-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New redux warning? #137
Comments
hi @jalada! we have an issue here to discuss in depth: react-navigation/rfcs#14 I wouldn't say it's bad necessarily, like I wrote in the warning "Storing your React Navigation state in your own Redux store is likely to give you a very difficult time if you don't know what you're doing." -- you can search the issues on the main react navigation repo and see how many are related to not integrating properly with Redux. Additionally, it's a lot more difficult for us to provide support for users who integrate their state into Redux because the environment is more complex and issues are harder to reproduce in an isolated way.
That's one way you could grab the dispatch function, yeah. If you'd like to perform navigation actions in some Redux middleware then this would be a good approach. |
The docs as-is make it sound like you can't user Redux with react-navigation at all. But in issues I'm reading that is only related to using redux to store navigation state. Might be worth adding an explicit comment to the docs on that. |
I personally agree with the warning about using redux, personally I find the mixing of navigation & application state to be ... weird. That being said, I think it would be a great idea to give a recommended alternative. A lot of us want to navigate to a separate route after a reducer finishes, but it's not clear what the recommended way to accomplish that is. |
@w7pea - could you send a PR to clarify that in the docs? thanks! |
@brentvatne, my grasp of redux is pretty low (I'm really a python dev) so I'm not sure how good my comments would be, but I'll provide this and let you all have a whack edit. I do stand by comment though and initially I thought I couldn't use react-navigation and redux at all in the same application (in my case react-native). Hope this helps. CurrentWarning: in the next major version of React Navigation, to be released in Fall 2018, we will no longer provide any information about how to integrate with Redux and it may cease to work. Issues related to Redux that are posted on the React Navigation issue tracker will be immediately closed. Redux integration may continue to work but it will not be tested against or considered when making any design decisions for the library. EditedWarning: in the next major version of React Navigation, to be released in Fall 2018, we will no longer provide any information about how to integrate with Redux to drive nvigation and it may cease to work. Issues related to Redux that are posted on the React Navigation issue tracker will be immediately closed. Redux integration to drive navigation may continue to work but it will not be tested against or considered when making any design decisions for the library. NOTE: This only pertains to using Redux to drive navigation. It does impact the ability to use Redux for its other common use cases. |
Hello!
We used
react-navigation
on a project a while ago, and integrated it with our Redux store as per the documentation. But I've just noticed you now have a warning telling people not to do this.LOGIN_SUCCEEDED
action would mutate both our app state and the navigation state to put the user in the right place. What's the recommended approach instead? Is it to navigate without the navigation prop?The text was updated successfully, but these errors were encountered: