useState and callback function
instead of passing a callback
function, use useEffect
hook, do some thing like this to achieve the desired result.
useEffect(() => {
console.log('state changed', your-state-variable)
// write your callback function here
}, [your-state-variable]);