lndsld

Home > @lndsld/react-hooks > usePropState

usePropState() function

Create state from prop

This state will by synced with prop

Signature:

declare function usePropState<T>(prop: T): [T, Dispatch<SetStateAction<T>>];

Parameters

Parameter Type Description
prop T prop value

Returns:

[T, Dispatch<SetStateAction<T>>]