I have a project that calls an API service on componentDidMount(), using the following code
class Posts extends Component {
componentDidMount() {
apiService.get(this.props.filters);
}
}
const mapStateToProps = state => {
return {
filters: state.filters
}
}
My component passes the filters from my redux store on to the API call.
But what if the filters change through another component? I can't seem to find the correct lifecycle method to re-call the api once that happens.