4 ms·
I haven't tried using Flux yet as I haven't really felt the need... Does anyone have insight on how to use it with React Native? Do you have a single action cre
by cocoflunchy 11y ago
I haven't tried using Flux yet as I haven't really felt the need... Does anyone have insight on how to use it with React Native? Do you have a single action creator / dispatcher for your whole app? It feels messy since my screens in the app are usually pretty independent (but maybe I haven't written a complex enough app yet... hard to tell).
- cel1ne 11y agoGo for Redux instead: http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial...
- kcorbitt 11y agoI recommend redux, like sibling commentor cel1ne. You should just use a single store for everything, as is recommended in the Redux docs, and then if a particular view of your app only needs a subset of all the data, just "connect" it to the subtree that's relevant using react-redux. I use it with React Native and it works great. Just be sure to use the react-redux instructions for React Native. The best thing about Redux (for me) is the ecosystem. There's tons of active development around middlewares (logging, persistence, routing, etc) and best practices. Its recent popularity means that you really can follow the beaten path and have a sane, performant app. EDIT: If you're interested in an example React Native/Redux app, you can check out the toy HN reader I'm working on[1]. There are some critical missing features that make it not yet effective as an HN reader, but it's a decent React Native for Android tech demo. [1]: https://github.com/corbt/HNReact https://github.com/corbt/HNReact