Closed mgrazianoc closed 3 years ago
It depends on your application, but the rule of thumb we've been using is something like:
If there's a chance the state might need to be used in several parts of the widget tree, or across routes, then Redux is the right place for it.
Another way to think about state is, to begin with, keep the data as close to where it is being used as possible. When you find that you need the piece of data somewhere else in the app, then move the data up in the hierarchy, or put it into the Redux store.
Happy to help with more specific cases, but that's the general approach we've been using.
I trully think this a good general advice and it made clear to me on what solutions should I think when developing apps with redux design (now I'm quetioning a lot of tutorials I've seen online).
Overall, I completely agree with @MichaelMarner, and that's how I use Redux for JS or Flutter!
I've seen folks try to store AnimationControllers
or TextEditingControllers
in their Redux store, but I've always just kept those in StatefulWidgets as well.
Hi there. I've been working with redux for the last couple of weeks and I've been really enjoying the process of planning, coding, scaling and deploing apps with much more control than before. There's one detail though which I haven't found any good source digging in on the following topic: what are the best practices to use redux when you surely can't have a stateless widget?
I agree that this question can be vague, but I don't have enough experience in the field to make it specific for several development cases.
Is there any particular or general device for these situations?
Thanks!