e81e8a8f71
* Revert "Revert "Merge branch 'main' of https://github.com/Uniswap/interface" (#2912)" This reverts commit 7d343dcfbdf75a2f91d28cefce84e4b1bace7b87. * Revert "deleted files" This reverts commit 097b8361d4c09afd3cb681c4622145c555ced884.
8 lines
274 B
TypeScript
8 lines
274 B
TypeScript
import { useCallback, useState } from 'react'
|
|
|
|
export default function useToggle(initialState = false): [boolean, () => void] {
|
|
const [state, setState] = useState(initialState)
|
|
const toggle = useCallback(() => setState((state) => !state), [])
|
|
return [state, toggle]
|
|
}
|