Custom React hook that creates a state that automatically synchronizes with an external value.
This hook allows you to manage local state that reflects the value of a prop.
When the prop changes, the internal state is updated to match the new prop value.
This is useful when you want to have controlled components that also
sync with their props.
Custom React hook that creates a state that automatically synchronizes with an external value.
This hook allows you to manage local state that reflects the value of a prop. When the prop changes, the internal state is updated to match the new prop value. This is useful when you want to have controlled components that also sync with their props.
Example