I have context, where the state of the variable is getting updated every second. And I want invoke functions in other component whenever the variable in the state reaches certain value [second equals 0]
State in the context
const initialState = {
second: new Date().getSeconds()
};
I'm able to get the value is other components as below
const [secState, dispatch] = useContext(SecContext);
`secState.second`
Can someone please guide how to invoke a function when
secState.secondis zeroI thought of triggering event in the useContext whenever the value reaches zero and listening on other component. not sure how to do it in react any hints or reference please