diff --git a/web/components/checkbox.tsx b/web/components/checkbox.tsx index df24ab6b..9cc7cae9 100644 --- a/web/components/checkbox.tsx +++ b/web/components/checkbox.tsx @@ -1,31 +1,31 @@ -import clsx from 'clsx' - -export function Checkbox(props: { - label: string - checked: boolean - toggle: (checked: boolean) => void - className?: string -}) { - const { label, checked, toggle, className } = props - - return ( -
-
-
- toggle(!e.target.checked)} - /> -
-
- -
-
-
- ) -} +import clsx from 'clsx' + +export function Checkbox(props: { + label: string + checked: boolean + toggle: (checked: boolean) => void + className?: string +}) { + const { label, checked, toggle, className } = props + + return ( +
+
+
+ toggle(!e.target.checked)} + /> +
+
+ +
+
+
+ ) +} diff --git a/web/hooks/use-event.ts b/web/hooks/use-event.ts index 443e1095..eb1c7b11 100644 --- a/web/hooks/use-event.ts +++ b/web/hooks/use-event.ts @@ -1,20 +1,20 @@ -// A hook soon to be added to the React core library: -// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md -// TODO: Once React adds this hook, use it instead. - -import { useRef, useLayoutEffect, useCallback } from 'react' - -type AnyFunction = (...args: any[]) => any - -export function useEvent(callback?: T) { - const ref = useRef(() => { - throw new Error('Cannot call an event handler while rendering.') - }) - useLayoutEffect(() => { - ref.current = callback - }) - return useCallback( - (...args) => ref.current?.apply(null, args), - [] - ) as T -} +// A hook soon to be added to the React core library: +// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md +// TODO: Once React adds this hook, use it instead. + +import { useRef, useLayoutEffect, useCallback } from 'react' + +type AnyFunction = (...args: any[]) => any + +export function useEvent(callback?: T) { + const ref = useRef(() => { + throw new Error('Cannot call an event handler while rendering.') + }) + useLayoutEffect(() => { + ref.current = callback + }) + return useCallback( + (...args) => ref.current?.apply(null, args), + [] + ) as T +}