import { useEffect , useState } from 'react' ; const useSynchronizingState = < V > ( value ) => { const [ state , setState ] = useState < V > ( value ) ; useEffect ( ( ) => { setState ( value ) ; } , [ value ] ) ; return [ state , setState ] as const ; } ; export default useSynchronizingState ;