Skip to content

Commit 4a347e4

Browse files
authored
docs(eng): standardize React hook descriptions for consistency (#207)
1 parent 94bbc08 commit 4a347e4

24 files changed

Lines changed: 36 additions & 32 deletions

src/hooks/useAsyncEffect/useAsyncEffect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# useAsyncEffect
22

3-
`useAsyncEffect` is a custom hook for handling asynchronous side effects in React components. It follows the same cleanup pattern as `useEffect` while ensuring async operations are handled safely.
3+
`useAsyncEffect` is a React hook for handling asynchronous side effects in React components. It follows the same cleanup pattern as `useEffect` while ensuring async operations are handled safely.
44

55
## Interface
66

src/hooks/useAsyncEffect/useAsyncEffect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DependencyList, useEffect } from 'react';
22

33
/**
44
* @description
5-
* `useAsyncEffect` is a custom hook for handling asynchronous side effects in React components.
5+
* `useAsyncEffect` is a React hook for handling asynchronous side effects in React components.
66
* It follows the same cleanup pattern as `useEffect` while ensuring async operations are handled safely.
77
*
88
* @param {() => Promise<void | (() => void)>} [effect] - An asynchronous function executed in the `useEffect` pattern.

src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# useCallbackOncePerRender
22

3-
A React hook that ensures a callback function is executed only once, regardless of how many times it's called. This is useful for one-time operations that should not be repeated, even if the component re-renders.
3+
`useCallbackOncePerRender` is a React hook that ensures a callback function is executed only once, regardless of how many times it's called. This is useful for one-time operations that should not be repeated, even if the component re-renders.
44

55
## Interface
66

src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import { usePreservedCallback } from '../usePreservedCallback/index.ts';
55

66
/**
77
* @description
8-
* A React hook that ensures a callback function is executed only once, regardless of
9-
* how many times it's called. This is useful for one-time operations that should not
10-
* be repeated, even if the component re-renders.
8+
* `useCallbackOncePerRender` is a React hook that ensures a callback function is executed only once, regardless of how many times it's called.
9+
* This is useful for one-time operations that should not be repeated, even if the component re-renders.
1110
*
1211
* @param {() => void} callback - The callback function to be executed once.
1312
* @param {DependencyList} deps - Dependencies array that will trigger a new one-time execution when changed.

src/hooks/useControlledState/useControlledState.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# useControlledState
22

3-
`useControlledState` is a hook that allows you to control both controlled and uncontrolled states. If you pass the state to `value`, it will be a controlled state, and if you pass the state to `defaultValue`, it will be an uncontrolled state. If both `value` and `defaultValue` are passed, `value` will take precedence.
3+
`useControlledState` is a React hook that allows you to control both controlled and uncontrolled states. If you pass the state to `value`, it will be a controlled state, and if you pass the state to `defaultValue`, it will be an uncontrolled state. If both `value` and `defaultValue` are passed, `value` will take precedence.
44

55
## Interface
66

src/hooks/useControlledState/useControlledState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type UseControlledStateProps<T> = ControlledState<T> & {
99

1010
/**
1111
* @description
12-
* `useControlledState` is a hook that allows you to control both controlled and uncontrolled states.
12+
* `useControlledState` is a React hook that allows you to control both controlled and uncontrolled states.
1313
* If you pass the state to `value`, it will be a controlled state, and if you pass the state to `defaultValue`, it will be an uncontrolled state.
1414
* If both `value` and `defaultValue` are passed, `value` will take precedence.
1515
*

src/hooks/useDebouncedCallback/useDebouncedCallback.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# useDebouncedCallback
22

3-
`useDebouncedCallback` is a React hook that returns a debounced version of the provided callback function. It helps optimize event handling by delaying function execution and grouping multiple calls into one. Note that if both 'leading' and 'trailing' are included, the function will be called at both the start and end of the delay period. However, it must be called at least twice within debounceMs milliseconds for this to happen, as one debounced function call cannot trigger the function twice.
3+
`useDebouncedCallback` is a React hook that returns a debounced version of the provided callback function. It helps optimize event handling by delaying function execution and grouping multiple calls into one. Note that if both 'leading' and 'trailing' are set, the function will be called at both the start and end of the delay period. However, it must be called at least twice within debounceMs interval for this to happen, since one debounced function call cannot trigger the function twice.
44

55
## Interface
66

src/hooks/useDebouncedCallback/useDebouncedCallback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type DebounceOptions = {
1313
* `useDebouncedCallback` is a React hook that returns a debounced version of the provided callback function.
1414
* It helps optimize event handling by delaying function execution and grouping multiple calls into one.
1515
*
16-
* Note that if both 'leading' and 'trailing' are included, the function will be called at both the start and end of the delay period. However, it must be called at least twice within debounceMs milliseconds for this to happen, as one debounced function call cannot trigger the function twice.
16+
* Note that if both 'leading' and 'trailing' are set, the function will be called at both the start and end of the delay period. However, it must be called at least twice within debounceMs interval for this to happen, since one debounced function call cannot trigger the function twice.
1717
*
1818
* @param {Object} options - The options object.
1919
* @param {Function} options.onChange - The callback function to debounce.

src/hooks/useImpressionRef/useImpressionRef.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# useImpressionRef
22

3-
`useImpressionRef` is a custom 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. This hook uses `IntersectionObserver` and the `Visibility API` to track the element's visibility.
3+
`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. It uses `IntersectionObserver` and the `Visibility API` to track the element's visibility.
44

55
## Interface
66

src/hooks/useImpressionRef/useImpressionRef.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export type UseImpressionRefOptions = Partial<{
1515

1616
/**
1717
* @description
18-
* `useImpressionRef` is a custom 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.
19-
* This hook uses `IntersectionObserver` and the `Visibility API` to track the element's visibility.
18+
* `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.
19+
* It uses `IntersectionObserver` and the `Visibility API` to track the element's visibility.
2020
*
2121
* @param {UseImpressionRefOptions} options - Options for tracking the element's visibility.
2222
* @param {() => void} [options.onImpressionStart] - Callback function executed when the element enters the view

0 commit comments

Comments
 (0)