One thing I need to point out is useEffect will always run on mount
So Side Effect Runs After X Value Change is kinda misleading
One issue you might face is to make some custom component with 2 way binding with some form lib(like react hook form
constMyCustomeInput=({onChange,value})=>{const[tmpValue,setTmpValue]=useState(value)useEffect(()=>{onChange(tmpValue)},[tmpValue])return// some custom Input}
You'll found that the input field is always dirty in the form state
Its because the onChange will not only fire on value change but also on mount
One thing I need to point out is useEffect will always run on mount
So
Side Effect Runs After X Value Change
is kinda misleadingOne issue you might face is to make some custom component with 2 way binding with some form lib(like react hook form
You'll found that the input field is always dirty in the form state
Its because the onChange will not only fire on value change but also on mount
Thanks, Mark ✌