usePrevious
usePrevious
is a custom hook for obtaining the previous value.
Import
import { usePrevious } from "@yamada-ui/react"
Usage
Editable example
const [flg, { toggle }] = useBoolean() const prevFlg = usePrevious(flg) return ( <> <Text> state: {String(flg)}, prev: {String(prevFlg)} </Text> <Button mt="md" onClick={toggle}> Click me to toggle the boolean value </Button> </> )
Edit this page on GitHub