mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-28 06:40:58 +00:00
18 lines
452 B
JavaScript
18 lines
452 B
JavaScript
'use client';
|
|
import { useState, useCallback } from 'react';
|
|
|
|
function useSetState(initialState) {
|
|
const [state, setState] = useState(initialState);
|
|
const _setState = useCallback(
|
|
(statePartial) => setState((current) => ({
|
|
...current,
|
|
...typeof statePartial === "function" ? statePartial(current) : statePartial
|
|
})),
|
|
[]
|
|
);
|
|
return [state, _setState];
|
|
}
|
|
|
|
export { useSetState };
|
|
//# sourceMappingURL=use-set-state.mjs.map
|