1---2name: react-simplikit3description: Selects and applies react-simplikit hooks, components and utils (useDebounce, useThrottle, useToggle, useBooleanState, useCounter, useList, useMap, useSet, useInterval, useTimeout, usePrevious, usePreservedCallback, useOutsideClickEffect, useIntersectionObserver, useStorageState, useLongPress, SwitchCase, Separated, mergeRefs, buildContext, ...) instead of hand-written equivalents, including the mobile-web keyboard, safe-area, visual viewport and body-scroll-lock hooks. Use when writing React state or effect logic, debouncing or throttling, boolean/counter/list/map/set state, intervals and timeouts, click-outside, long-press or double-click handling, viewport visibility or impression tracking, persisted state in localStorage/sessionStorage, conditional rendering, merging refs, React Context boilerplate, or SSR-safe browser access, and whenever the project depends on react-simplikit.4license: MIT5---67<!-- GENERATED by `yarn skill:gen` from the documentation pages in packages/react-simplikit/src — edit .scripts/commands/generateSkill/template.md, not this file. -->89# react-simplikit1011Zero-dependency React hooks, components and utils in one package, `react-simplikit`. Alongside state/logic and browser-event hooks it covers the mobile-web problems — on-screen keyboard, safe-area insets, visual viewport, body scroll lock — that usually get hand-written.1213## Critical rules1415- **Check the catalog before hand-writing debounce, throttle, toggle, counter, list/map/set state, interval, timeout, previous-value, stable-callback, click-outside, long-press, intersection/visibility or storage-persisted-state logic.** If a matching entry exists, use it. Reimplementing these is the most common mistake this skill exists to prevent.16- **Never guess a signature.** Before using an entry, read `references/<name>.md` — it has the parameter table, return shape and a working example.17- **One import path, named imports only**: `import { useDebounce, useKeyboardHeight } from 'react-simplikit'`. There is no subpath and no default export.18- **SSR**: never branch server-rendered markup on a value that comes from a browser API hook. Use `useIsClient` for client-only rendering instead of `typeof window` checks.19- **Do not wrap or re-export these hooks** in the consumer project just to rename them; use them directly so upgrades stay mechanical.2021## Common needs → use2223Backticks in this table mark catalog entries only.2425| Need | Use |26| ------------------------------------------------------------------- | ---------------------------------------- |27| Debounce a callback (search input, resize) | `useDebounce` / `useDebouncedCallback` |28| Throttle a callback (scroll, pointer move) | `useThrottle` / `useThrottledCallback` |29| Boolean on/off, flip only | `useToggle` |30| Boolean on/off with explicit set-true / set-false | `useBooleanState` |31| Numeric state with bounds/step | `useCounter` |32| Array / Map / Set state with immutable helpers | `useList` / `useMap` / `useSet` |33| State persisted in localStorage / sessionStorage | `useStorageState` |34| Declarative setInterval / setTimeout | `useInterval` / `useTimeout` |35| Stable callback identity without stale closures | `usePreservedCallback` |36| Skip re-renders when an object is deep-equal | `usePreservedReference` |37| Run an async function in an effect | `useAsyncEffect` |38| Effect that runs only when a condition holds | `useConditionalEffect` |39| Side effect tied to a DOM ref (attach/detach) | `useRefEffect` |40| Click / tap outside an element (close menu, modal) | `useOutsideClickEffect` |41| Long press / double click | `useLongPress` / `useDoubleClick` |42| Element enters or leaves the viewport | `useIntersectionObserver` |43| How long an element stayed visible (impression tracking) | `useImpressionRef` / `ImpressionArea` |44| React to tab / page visibility changes with a callback | `useVisibilityEvent` |45| Read the current tab / page visibility as state | `usePageVisibility` |46| Device location | `useGeolocation` |47| Combine multiple refs into one | `mergeRefs` |48| Controlled-or-uncontrolled component state | `useControlledState` |49| Input onChange boilerplate | `useInputState` |50| Render one of several components by key | `SwitchCase` |51| Put a separator between children | `Separated` |52| Create a Context + Provider + hook without boilerplate | `buildContext` |53| Merge props objects (handlers chained, className joined) | `mergeProps` |54| Client-only rendering guard | `useIsClient` |55| Fixed-bottom element must avoid the on-screen keyboard (mobile web) | `useAvoidKeyboard` |56| Keyboard height / visibility (mobile web) | `useKeyboardHeight`, `isKeyboardVisible` |57| Notch / home-indicator insets (mobile web) | `useSafeAreaInset`, `getSafeAreaInset` |58| Lock body scroll while a sheet/modal is open (mobile web) | `useBodyScrollLock` |5960## Workflow61621. Match the need against the table above, then confirm in the full catalog.632. Read `references/<name>.md` for the signature and example. Do not rely on memory.643. Import from `react-simplikit`.654. If nothing matches, write plain React — do not stretch a hook past its documented purpose.6667## Catalog6869### hooks7071| Name | Description |72| --- | --- |73| [`useAsyncEffect`](references/useAsyncEffect.md) | `useAsyncEffect` is a React hook for handling asynchronous side effects in React components. |74| [`useAvoidKeyboard`](references/useAvoidKeyboard.md) | `useAvoidKeyboard` is a React hook that helps fixed-bottom elements avoid the on-screen keyboard. |75| [`useBodyScrollLock`](references/useBodyScrollLock.md) | `useBodyScrollLock` is a React hook that locks body scroll while the component is mounted. |76| [`useBooleanState`](references/useBooleanState.md) | `useBooleanState` is a React hook that simplifies managing a boolean state. |77| [`useCallbackOncePerRender`](references/useCallbackOncePerRender.md) | `useCallbackOncePerRender` is a React hook that ensures a callback function is executed only once, regardless of how many times it's called. |78| [`useConditionalEffect`](references/useConditionalEffect.md) | `useConditionalEffect` is a React hook that conditionally executes effects based on a predicate function. |79| [`useControlledState`](references/useControlledState.md) | `useControlledState` is a React hook that allows you to control both controlled and uncontrolled states. |80| [`useCounter`](references/useCounter.md) | `useCounter` is a React hook that manages a numeric counter state with increment, decrement, and reset capabilities. |81| [`useDebounce`](references/useDebounce.md) | `useDebounce` is a React hook that returns a debounced version of the provided callback function. |82| [`useDebouncedCallback`](references/useDebouncedCallback.md) | `useDebouncedCallback` is a React hook that returns a debounced version of the provided callback function. |83| [`useDebouncedValue`](references/useDebouncedValue.md) | `useDebouncedValue` is a React hook that returns a debounced copy of the given value. |84| [`useDoubleClick`](references/useDoubleClick.md) | `useDoubleClick` is a React hook that differentiates between single and double click events. |85| [`useGeolocation`](references/useGeolocation.md) | `useGeolocation` is a React hook that retrieves and tracks the user's geographical location. |86| [`useImpressionRef`](references/useImpressionRef.md) | `useImpressionRef` is a React hook that measures the time a specific DOM element is visible on the screen and executes callbacks when the element enters or exits the viewport. |87| [`useInputState`](references/useInputState.md) | `useInputState` is a React hook that manages an input state with optional value transformation. |88| [`useIntersectionObserver`](references/useIntersectionObserver.md) | `useIntersectionObserver` is a React hook that detects whether a specific DOM element is visible on the screen. |89| [`useInterval`](references/useInterval.md) | `useInterval` is a React hook that executes a function at a specified interval. |90| [`useIsClient`](references/useIsClient.md) | `useIsClient` is a React hook that returns `true` only in the client-side environment. |91| [`useIsomorphicLayoutEffect`](references/useIsomorphicLayoutEffect.md) | `useIsomorphicLayoutEffect` is a React hook that provides the behavior of `useLayoutEffect` without triggering warnings during server-side rendering. |92| [`useKeyboardHeight`](references/useKeyboardHeight.md) | `useKeyboardHeight` is a React hook that tracks the on-screen keyboard height. |93| [`useList`](references/useList.md) | A React hook that manages an array as state. |94| [`useLoading`](references/useLoading.md) | `useLoading` is a React hook that simplifies managing the loading state of a `Promise`. |95| [`useLongPress`](references/useLongPress.md) | `useLongPress` is a React hook that detects when an element is pressed and held for a specified duration. |96| [`useMap`](references/useMap.md) | A React hook that manages a key-value Map as state. |97| [`useNetworkStatus`](references/useNetworkStatus.md) | `useNetworkStatus` is a React hook that provides access to the Network Information API. |98| [`useOutsideClickEffect`](references/useOutsideClickEffect.md) | `useOutsideClickEffect` is a React hook that triggers a callback when a click event occurs outside the specified container(s). |99| [`usePageVisibility`](references/usePageVisibility.md) | `usePageVisibility` is a React hook that detects page visibility changes. |100| [`usePreservedCallback`](references/usePreservedCallback.md) | `usePreservedCallback` is a React hook that maintains a stable reference to a callback function while ensuring it always has access to the latest state or props. |101| [`usePreservedReference`](references/usePreservedReference.md) | `usePreservedReference` is a React hook that helps maintain the reference of a value when it hasn't changed, while ensuring you can safely use the latest state. |102| [`usePrevious`](references/usePrevious.md) | `usePrevious` is a React hook that returns the previous value of the input state. |103| [`useRefEffect`](references/useRefEffect.md) | `useRefEffect` is a React hook that helps you set a reference to a specific DOM element and execute a callback whenever the element changes. |104| [`useSafeAreaInset`](references/useSafeAreaInset.md) | `useSafeAreaInset` is a React hook that tracks safe area inset changes. |105| [`useScrollDirection`](references/useScrollDirection.md) | `useScrollDirection` is a React hook that detects scroll direction. |106| [`useSet`](references/useSet.md) | A React hook that manages a Set as state. |107| [`useStorageState`](references/useStorageState.md) | `useStorageState` is a React that functions like `useState` but persists the state value in browser storage. |108| [`useThrottle`](references/useThrottle.md) | `useThrottle` is a React hook that creates a throttled version of a callback function. |109| [`useThrottledCallback`](references/useThrottledCallback.md) | `useThrottledCallback` is a React hook that returns a throttled version of the provided callback function. |110| [`useThrottledValue`](references/useThrottledValue.md) | `useThrottledValue` is a React hook that returns a throttled copy of the given value. |111| [`useTimeout`](references/useTimeout.md) | `useTimeout` is a React hook that executes a callback function after a specified delay. |112| [`useToggle`](references/useToggle.md) | `useToggle` is a React hook that simplifies managing a boolean state. |113| [`useVisibilityEvent`](references/useVisibilityEvent.md) | `useVisibilityEvent` is a React hook that listens to changes in the document's visibility state and triggers a callback. |114| [`useVisualViewport`](references/useVisualViewport.md) | `useVisualViewport` is a React hook that tracks Visual Viewport changes. |115116### components117118| Name | Description |119| --- | --- |120| [`ImpressionArea`](references/ImpressionArea.md) | `ImpressionArea` is a component that measures the time a specific DOM element is visible on the screen and executes callbacks when the element enters or exits the viewport. |121| [`Separated`](references/Separated.md) | `Separated` is a component that inserts a specified component between each child element. |122| [`SwitchCase`](references/SwitchCase.md) | `SwitchCase` is a component that allows you to declaratively render components based on a given value, similar to a `switch-case` statement. |123124### utils125126| Name | Description |127| --- | --- |128| [`buildContext`](references/buildContext.md) | `buildContext` is a helper function that reduces repetitive code when defining React Context. |129| [`disableBodyScrollLock`](references/disableBodyScrollLock.md) | `disableBodyScrollLock` is a utility function that unlocks the body scroll. |130| [`enableBodyScrollLock`](references/enableBodyScrollLock.md) | `enableBodyScrollLock` is a utility function that locks the body scroll. |131| [`getKeyboardHeight`](references/getKeyboardHeight.md) | `getKeyboardHeight` is a utility function that returns the current on-screen keyboard height in pixels. |132| [`getSafeAreaInset`](references/getSafeAreaInset.md) | `getSafeAreaInset` is a utility function that returns all safe area insets in pixels as an object. |133| [`isAndroid`](references/isAndroid.md) | `isAndroid` is a utility function that detects whether the current device is running Android. |134| [`isIOS`](references/isIOS.md) | `isIOS` is a utility function that detects whether the current device is running iOS or iPadOS. |135| [`isKeyboardVisible`](references/isKeyboardVisible.md) | `isKeyboardVisible` is a utility function that checks whether the on-screen keyboard is currently visible. |136| [`isServer`](references/isServer.md) | `isServer` is a utility function that checks if the code is running on the server. |137| [`mergeProps`](references/mergeProps.md) | `mergeProps` is a utility function that merges multiple props objects into a single object. |138| [`mergeRefs`](references/mergeRefs.md) | This function takes multiple refs (RefObject or RefCallback) and returns a single ref that updates all provided refs. |139| [`subscribeKeyboardHeight`](references/subscribeKeyboardHeight.md) | `subscribeKeyboardHeight` is a utility function that subscribes to changes in the on-screen keyboard height. |140141## Learn more142143- Docs: https://react-simplikit.slash.page144- Machine-readable index: https://react-simplikit.slash.page/llms.txt (full text: /llms-full.txt; any docs page + `.md` returns raw markdown)145- Source: https://github.com/toss/react-simplikit