1.2.3 • Published 3 years ago
@10up/react-hooks v1.2.3
Hooks
Battle tested hooks that can be reused and are safe to use within SSR environments.
List
useCurrentBreakpoint- Context + Hook to track current CSS breakpoint by leveragingmatchMedia.useDebounce- Hook to debounce a quickly changing value, so it doesn't re-render as much.useDebouncedCallback- Hook to debounce an effect that's quickly called.useEffectAfterRender- Hook that only dispatches the effect if the component is mounted.useEvent- Hook foraddEventListenerto any element.useFocusTrap- Hook to trap focus inside a DOM element. This is great for trapping the focus within a Modal for example.useIsMounted- Hook that returns a function that will yield the current mount state of the component.useIsTransitioning- Context + Hook that tracksrouteChangeevents from Next's Router.useKey- A convenient wrapper arounduseEventto handle key presses allowing to send either the key being watched, a function to evaluate or any truthy/falsy value.useOnClickOutside- Hook to add a handler to be executed when the user clicks outside a given ref.useOnMount- Hook to add a handler to be executed when the component mounts.useOnWindowResize- Hook to attach a handler to window resize.useSafeLayoutEffect- Alias hook to safely useuseLayoutEffectwithin SSR environments.useScript- Hook to append a script into the page, preventing the same script to be included more than once.
Development
You can create a new hook by running npm run create-hook hookName which will bootstrap the files for you. You might want to run npm run create-hook without any options if you want to see all possible inputs.
1.2.0
3 years ago
1.1.0
3 years ago
1.0.1-alpha.8
3 years ago
1.0.1-alpha.7
3 years ago
1.2.3
3 years ago
1.2.2
3 years ago
1.2.1
3 years ago
1.0.1-alpha.6
3 years ago
1.0.1-alpha.5
3 years ago
1.0.1-alpha.4
3 years ago
1.2.1-next.0
3 years ago
1.0.1-alpha.3
3 years ago
1.0.1-alpha.2
3 years ago
1.0.1-alpha.1
3 years ago
1.0.1-alpha.0
3 years ago
1.0.0
3 years ago