This is a lot more code than you need. Taking your original sample, put value into a ref from useRef, and inside the useCallback function, get value from your ref. Also, don't use [value] as a dependency, use only [] dependencies, this way it only runs once.
This is a lot more code than you need. Taking your original sample, put
valueinto a ref fromuseRef, and inside theuseCallbackfunction, getvaluefrom your ref. Also, don't use[value]as a dependency, use only[]dependencies, this way it only runs once.