react-simplikit
v0.0.53
Published
[](https://www.npmjs.com/package/react-simplikit) [](https://github.com/toss/react-simplikit/blob/main/LICENSE) [.
What's Maintained: Pure State/Logic Hooks
Hooks that don't depend on specific platform APIs will continue to be actively maintained:
- State management hooks like
useToggle,useBooleanState,useCounter - Lifecycle hooks like
usePrevious - Utility hooks like
useDebounce,useThrottle - Backward compatibility (BC) is preserved for these existing pure logic hooks
What's Deprecated: Browser/Platform-Dependent Hooks
The following hooks that strongly depend on browser-specific APIs are now deprecated:
useGeolocation- depends onnavigator.geolocationuseStorageState- depends onlocalStorage/sessionStorageuseIntersectionObserver- depends onIntersectionObserverAPIuseImpressionRef- depends onIntersectionObserver+ Visibility APIuseDoubleClick,useLongPress- depend on DOM events +window.setTimeoutuseOutsideClickEffect- depends on DOM events +documentuseVisibilityEvent- depends ondocument.visibilityState
These hooks:
- Will not receive new features or major enhancements
- Are marked as
@deprecatedin documentation - May be removed in future major versions
Package Status
- react-simplikit will not be archived
- Pure state/logic hooks will continue to be maintained
- Critical bug fixes and minimal maintenance will continue
- No new browser/platform-dependent hooks will be added
Installation
npm install react-simplikit
# or
yarn add react-simplikit
# or
pnpm add react-simplikitQuick Start
import { useState } from 'react';
import { useDebounce } from 'react-simplikit';
function SearchInput() {
const [query, setQuery] = useState('');
const debouncedSearch = useDebounce((value: string) => {
// Actual API call
searchAPI(value);
}, 300);
return (
<input
value={query}
onChange={e => {
setQuery(e.target.value);
debouncedSearch(e.target.value);
}}
placeholder="Enter search term"
/>
);
}The debounced function exposes .cancel(), and pending calls are cancelled automatically when the component unmounts.
What's Included
Hooks
| Hook | Description |
| ------------------------- | ----------------------------------------------------- |
| useBooleanState | Manage boolean state with handlers |
| useDebounce | Debounce a callback function |
| useDebouncedCallback | Debounce an onChange callback via an options object |
| useInterval | Set up intervals declaratively |
| useIntersectionObserver | Observe element visibility |
| usePreservedCallback | Stable callback reference |
| usePreservedReference | Stable object reference |
| ... | See all hooks |
Components
| Component | Description |
| ---------------- | --------------------------------- |
| SwitchCase | Declarative switch-case rendering |
| Separated | Render items with separators |
| ImpressionArea | Track element impressions |
Utilities
| Utility | Description |
| -------------- | --------------------------------------------------- |
| buildContext | Define React Context with less boilerplate |
| mergeProps | Merge props, composing className, style, events |
| mergeRefs | Combine multiple refs into a single ref |
Documentation
Visit react-simplikit.slash.page for full documentation.
Related Packages
- @react-simplikit/mobile - Mobile web utilities
Contributing
We welcome contributions! Please see our Contributing Guide.
License
MIT © Viva Republica, Inc. See LICENSE for details.
