MCPcopy Create free account
hub / github.com/dailydotdev/apps / toggle

Function toggle

packages/shared/src/hooks/useToggle.ts:9–16  ·  view source on GitHub ↗
(forced?: boolean)

Source from the content-addressed store, hash-verified

7export const useToggle: UseToggle = (initialState) => {
8 const [state, setState] = useState(initialState);
9 const toggle = (forced?: boolean) => {
10 if (typeof forced === 'boolean') {
11 setState(forced);
12 return;
13 }
14
15 setState((value) => !value);
16 };
17 return [state, toggle] as const;
18};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected