react hooks props in useEffect
If the value of props.filters
did not change, then React would skip the effect.
// This will only re-run if the value of `props.filters` changesuseEffect(() => { fetchSomeData(props.filters);}, [props.filters]);
With hooks, React does this internally unlike the implementation using componentDidUpdate
where we have to compare the value of prevProps
and nextProps
against each other.