Function createStateProvider
createStateProvider<S extends unknown>(): readonly [ ( __namedParameters: { children: ReactNode; initialState: S | () => S; onChange?: (state: S) => void; }, ) => Element, () => readonly [S, (state: S | (prevState: S) => S) => void],] Returns readonly [
(
__namedParameters: {
children: ReactNode;
initialState: S | () => S;
onChange?: (state: S) => void;
},
) => Element,
() => readonly [S, (state: S | (prevState: S) => S) => void],
]
- A tuple containing the Provider component and the useStateProvider function.
Creates a state provider with a given state type.