What are the advantages of fetching data with Redux as described here compared to just using the regular pattern with
class Posts extends Component {
state = { posts: [] };
componentDidMount() {
fetch(url).then(res => this.setState({ posts: res.json().posts });
}
render() {
return ...
}
}
Is it to make asynchronous fetching easier? Does it make it easier to persist the data in the store, so I can retrieve it when I reopen the app without having to fetch again?
It is actually not a question about why to fetch data from async actions, it seems you need to understand what advantages Redux library as a whole brings.
Read the article from Redux library author, whether you actually need Redux or not, or what advantages it brings: https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With