use-good-hooks 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +10 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -33,7 +33,7 @@ pnpm add use-good-hooks
33
33
  Debounces value changes to prevent rapid updates. Useful for search inputs, form validation, and other scenarios where you want to delay state updates until after a user has stopped changing the input.
34
34
 
35
35
  ```typescript
36
- import { useDebounce } from 'use-good-hooks/use-debounce';
36
+ import useDebounce from 'use-good-hooks/use-debounce';
37
37
 
38
38
  const SearchComponent = () => {
39
39
  const [searchTerm, setSearchTerm] = useState('');
@@ -71,7 +71,7 @@ const SearchComponent = () => {
71
71
  Creates a debounced version of a function. This hook ensures that a function is only executed after a specified period of inactivity, preventing it from being called too frequently. It's ideal for handling events like button clicks or API triggers that should not fire on every user action.
72
72
 
73
73
  ```typescript
74
- import { useDebounceFn } from 'use-good-hooks/use-debounce-fn';
74
+ import useDebounceFn from 'use-good-hooks/use-debounce-fn';
75
75
 
76
76
  const SaveButton = () => {
77
77
  const [status, setStatus] = useState('Idle');
@@ -110,7 +110,7 @@ const SaveButton = () => {
110
110
  Limits the rate at which a value can update. Useful for scroll events, window resizing, and other high-frequency events.
111
111
 
112
112
  ```typescript
113
- import { useThrottle } from 'use-good-hooks/use-throttle';
113
+ import useThrottle from 'use-good-hooks/use-throttle';
114
114
 
115
115
  const ScrollTracker = () => {
116
116
  const [scrollY, setScrollY] = useState(0);
@@ -143,7 +143,7 @@ const ScrollTracker = () => {
143
143
  Creates a throttled version of a function, limiting its execution to at most once per specified interval. It is useful for performance-critical scenarios like handling mouse movements, scrolling, or window resizing events without overwhelming the browser.
144
144
 
145
145
  ```typescript
146
- import { useThrottleFn } from 'use-good-hooks/use-throttle-fn';
146
+ import useThrottleFn from 'use-good-hooks/use-throttle-fn';
147
147
 
148
148
  const MouseTracker = () => {
149
149
  const [position, setPosition] = useState({ x: 0, y: 0 });
@@ -179,7 +179,7 @@ const MouseTracker = () => {
179
179
  Captures the previous value of a state or prop. Useful for comparing changes between renders.
180
180
 
181
181
  ```typescript
182
- import { usePrev } from 'use-good-hooks/use-prev';
182
+ import usePrev from 'use-good-hooks/use-prev';
183
183
 
184
184
  const Counter = ({ count }) => {
185
185
  const prevCount = usePrev(count);
@@ -207,7 +207,7 @@ const Counter = ({ count }) => {
207
207
  Tracks the history of a state value, providing undo and redo capabilities. This is perfect for building editors, forms, or any UI where users might want to reverse their actions.
208
208
 
209
209
  ```typescript
210
- import { useStateHistory } from 'use-good-hooks/use-state-history';
210
+ import useStateHistory from 'use-good-hooks/use-state-history';
211
211
 
212
212
  const TextEditor = () => {
213
213
  const {
@@ -261,7 +261,7 @@ const TextEditor = () => {
261
261
  Detects distinct changes in values with support for deep comparison and custom equality checks. Useful for tracking whether complex objects have actually changed.
262
262
 
263
263
  ```typescript
264
- import { useDistinct } from 'use-good-hooks/use-distinct';
264
+ import useDistinct from 'use-good-hooks/use-distinct';
265
265
 
266
266
  const UserProfileForm = ({ user }) => {
267
267
  const { distinct, value, prevValue } = useDistinct(user, { deep: true });
@@ -303,7 +303,7 @@ const UserProfileForm = ({ user }) => {
303
303
  Persists state to localStorage or sessionStorage with automatic serialization/deserialization.
304
304
 
305
305
  ```typescript
306
- import { useStorageState } from 'use-good-hooks/use-storage-state';
306
+ import useStorageState from 'use-good-hooks/use-storage-state';
307
307
 
308
308
  const ThemePreferences = () => {
309
309
  const [preferences, setPreferences, { removeKey }] = useStorageState('theme-prefs', {
@@ -354,7 +354,7 @@ const ThemePreferences = () => {
354
354
  Synchronizes state with URL query parameters. Great for shareable UI states, filters, pagination, and search terms.
355
355
 
356
356
  ```typescript
357
- import { useUrlState } from 'use-good-hooks/use-url-state';
357
+ import useUrlState from 'use-good-hooks/use-url-state';
358
358
 
359
359
  const ProductFilter = () => {
360
360
  const [filters, setFilters] = useUrlState({
@@ -496,7 +496,7 @@ const MyComponent = () => {
496
496
  Creates a temporary state that resets after a specified timeout.
497
497
 
498
498
  ```typescript
499
- import { useTemporaryState } from 'use-good-hooks/use-temporary-state';
499
+ import useTemporaryState from 'use-good-hooks/use-temporary-state';
500
500
 
501
501
  const [state, setState] = useTemporaryState('initial', 1000);
502
502
 
package/package.json CHANGED
@@ -49,5 +49,5 @@
49
49
  "test": "vitest",
50
50
  "test:coverage": "vitest --coverage"
51
51
  },
52
- "version": "1.0.26"
52
+ "version": "1.0.27"
53
53
  }