2

Assume your app doesn't need to work offline. Also assume that you want to render some fresh data from server -> Redux store for that data is invalidated every time it's rendered.

Does it make sense to store such data into Redux store? Creating reducers for data that is invalidated anyway seems like waste of time.

1 Answer 1

2

Yes, you should have getters for soon-to-be-invalidated data.

The Flux approach (Redux included) generally encourages synchronous getters for the application's current state. It doesn't have to be "correct" from the server's POV, but it needs to be complete and usable. Stores and reducers are generally not responsible for syncing up with the back end; how that is handled exactly varies between implementations.

If an update comes in from the server, an action will get fired to the stores/reducers, and the views will re-render this data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.