next 16; react 19; node 24 (#263)
* next 16; react 19 * fix build errors * add typecheck to workflow * use node 24 * claude update
This commit is contained in:
1 parent
60fb98ddeb
commit
3df47621a2
12 files changed
+1721
-736
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { useReducer } from "react"
|
||||
import { useCallback, useState } from "react"
|
||||
|
||||
export function useToggle(initialValue: boolean): [boolean, (nextValue?: boolean) => void] {
|
||||
return useReducer(
|
||||
(state: boolean, next?: boolean) => typeof next === "boolean" ? next : !state,
|
||||
initialValue,
|
||||
)
|
||||
const [state, setState] = useState(initialValue)
|
||||
const toggle = useCallback((next?: boolean) => {
|
||||
setState(prev => typeof next === "boolean" ? next : !prev)
|
||||
}, [])
|
||||
return [state, toggle]
|
||||
}
|
||||
Reference in new issue
Block a user