I'm quite new to React and functional programming. I want to build a parent component that basically tells what the child component should render:
const Parent = (props) => {
// blablabla...
useEffect(() => {
// blablabla...
let newSomeOtherState = doSomething(stateThatFrequentlyChange, stateThatSeldomChange)
setSomeOtherState(newSomeOtherState)
}, [stateThatFrequentlyChange, stateThatSeldomChange])
return <Child data={someOtherState} />
}
The problem is that I only want the parent component to listen to the stateThatSeldomChange
and then update someOtherState
based on the current stateThatFrequentlyChange
.
If I remove stateThatFrequentlyChange
, React would complain that React Hooks useEffect has missing dependencies...
.
How should I solve this warning?