useSyncedState

useState that updates to the new value when the initial state changes.

Try changing the initial value above. The synced state will update automatically. You can also edit the synced state directly, and it will maintain your changes until the initial value changes.

A hook that behaves like useState, but automatically syncs the local state when the initial value changes. This is useful when you need local state that can be modified by the user, but should also update when the source value changes from a parent component or prop.

Features