2024-08-20 23:25:37 +04:00

7 lines
320 B
TypeScript

/**
* Sync value with state.
* This should only used for internal which not affect outside calculation.
* Since it's not safe for suspense.
*/
export default function useSyncState<T>(defaultValue: T, controlledValue?: T): [getter: (useControlledValueFirst?: boolean) => T, setter: (nextValue: T) => void, value: T];