react-simplikit
v0.0.48
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,useMount - 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, useEffect } from 'react';
import { useDebounce } from 'react-simplikit';
function SearchInput() {
const [query, setQuery] = useState('');
const debouncedQuery = useDebounce(query, 300);
useEffect(() => {
if (debouncedQuery) {
searchAPI(debouncedQuery);
}
}, [debouncedQuery]);
return <input value={query} onChange={e => setQuery(e.target.value)} />;
}What's Included
Hooks
| Hook | Description |
| ------------------------- | --------------------------------------------------- |
| useBooleanState | Manage boolean state with handlers |
| useDebounce | Debounce a value |
| useDebouncedCallback | Debounce a callback function |
| 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 |
| -------- | ----------------- |
| assert | Runtime assertion |
| noop | Empty function |
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.
