{"id":13607231,"url":"https://github.com/ecomfe/react-hooks","last_synced_at":"2025-08-02T12:42:57.144Z","repository":{"id":41176173,"uuid":"219150643","full_name":"ecomfe/react-hooks","owner":"ecomfe","description":"Collection of react hooks","archived":false,"fork":false,"pushed_at":"2023-08-30T11:24:35.000Z","size":12005,"stargazers_count":803,"open_issues_count":27,"forks_count":84,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-07-03T06:42:16.705Z","etag":null,"topics":["react-hooks"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ecomfe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-11-02T12:28:44.000Z","updated_at":"2025-05-30T07:44:45.000Z","dependencies_parsed_at":"2024-01-19T10:13:18.752Z","dependency_job_id":"466ba2d9-25fd-4b6b-88f4-9fa58dec857b","html_url":"https://github.com/ecomfe/react-hooks","commit_stats":{"total_commits":219,"total_committers":19,"mean_commits":"11.526315789473685","dds":0.1735159817351598,"last_synced_commit":"2dae90c2fa543f66898edf92a0fec19753776580"},"previous_names":[],"tags_count":407,"template":false,"template_full_name":null,"purl":"pkg:github/ecomfe/react-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freact-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freact-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freact-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freact-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecomfe","download_url":"https://codeload.github.com/ecomfe/react-hooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freact-hooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268392180,"owners_count":24243297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-hooks"],"created_at":"2024-08-01T19:01:16.753Z","updated_at":"2025-08-02T12:42:57.091Z","avatar_url":"https://github.com/ecomfe.png","language":"TypeScript","readme":"# React Hooks\n\nThis is a collection of frequently used react hooks to support development within baidu, contributions from community are also welcomed.\n\n## Project structure\n\nThis is a typical pnpm workspace based monorepo, each hook creates a package in `packages` folder, the folder name is dash-cased and without the `use` prefix.\n\nPackage name must comform a format of `@huse/foo-bar`.\n\nEach package should named export at least one hook like:\n\n```js\nimport {useInputValue} from '@huse/input-value';\n```\n\nUnit tests are recommended, they are placed inside `src/__tests__` folder with an extension of `.test.js`, we highly recommend a 100% of branch coverage.\n\n## Document\n\nBy now we are unable to publish document online since `docz build` fails, you can find description to package in its `README.md`, or to start a document site locally.\n\n```\npnpm install\nnpm run doc:dev\n```\n\nOpen `http://localhost:3000` to view documents about hooks.\n\n### All hooks\n\n| Hook | Description |\n| ---- | ----------- |\n| useActionPending | Add a pending indicator to any async function |\n| useBoolean | Methods to control a boolean state |\n| useSwitch | More convenient way to use boolean state |\n| useToggle | More convenient way to toggle boolean state or setState directly |\n| useClickOutside | Trigger callback when clicks outside a specific element |\n| useArray | Methods to control array state |\n| useSet | Methods to control `Set` state |\n| useMap | Methods to control `Map` state |\n| useDebouncedEffect | Debounce an effect on value change |\n| useDebouncedValue | Debounce a value change |\n| useDebouncedCallback | Debounce a callback function |\n| useRenderTimes | Return times of component rendered |\n| useChangeTimes | Return times of a value changed |\n| useUpdateCause | Observe the cause of component update |\n| useDerivedState | Derive a state from external prop |\n| useDocumentEvent | Add listeners to `document`'s event |\n| useDocumentTitle | Change `document.title` |\n| useEffectRef | More reliable function based ref with clean-up ability |\n| useElementResize | Trigger callback when element resize |\n| useElementSize | Return element's size |\n| useHover | Observe mouse enter and leave to element |\n| useImmerReducer | A `useReducer` with immer support **(deprecated)** |\n| useImmerState | A `useState` with immer support **(deprecated)** |\n| useInfiniteScroll | Encapsulate methods and props to implement infinite scroll |\n| useInputValue | Bound a value and it's change handler to input element |\n| useOnScreenCallback | Trigger callback when element intersects with viewport |\n| useOnScreen | Return whether element intesects with viewport |\n| useOnScreenLazyValue | Lazy initialize a value when it intersects with viewport |\n| useLocalStorage | Visit and update local storage |\n| useMedia | Return whether a media query is currently matched |\n| usePreferDarkMode | Return whether user prefers dark color scheme |\n| useMergedRef | Merge multiple ref into a single one |\n| useMethodsNative | Wrap methods around a state |\n| useMethodsExtensionNative | Wrap methods around a `setState` function |\n| useMethods | `useMethodsNative` with immer support |\n| useMethodsExtension | `useMethodsNative` with immer support |\n| useOnLine | Return user is current online of offline |\n| useCounter | Methods to control a number state with increment and decrement |\n| usePerformanceTiming | Collect performance data and send to callback |\n| useLayoutTiming | Collect timings of a component's layout |\n| usePoll | Periodically trigger an async function and manage its response |\n| usePreviousValue | Get previous version of a value |\n| usePreviousEquals | Return whether a value is equals to that on previous render |\n| useOriginalCopy | Track back a value to get a reference equals copy when content are identical |\n| useOriginalDeepCopy | `useOriginalCopy` with deep equal support |\n| useRequestCallback | Return a function to trigger request with its data, error and pending state |\n| useRequest | Trigger request on params change and return its data, error and pending state |\n| useScript | Load an external script |\n| useScriptSuspense | Load an external script with suspense |\n| useScrollIntoView | Scroll an element into viewport |\n| useScrollLock | Lock scroll of document |\n| useScrollPosition | Get current scroll top and left |\n| useScrollTop | Get current scroll top |\n| useScrollLeft | Get current scroll left |\n| useSelection | Manage state to work with list selection, including multiple and range selection |\n| useSnapshotState | Get a state with undo and redo support |\n| useTimeout | Trigger callback after specified time |\n| useInterval | Trigger callback periodically |\n| useStableInterval | `useInterval` but counts ellapsed time of function execution, both sync and async |\n| useTransitionState | A state which will revert back to its initial value when updated |\n| useForceUpdate | Force update a component |\n| useWindowSize | Get the size of window |\n| useOptimisticFactory | Infrastructure hook to create optimistic state |\n| useOptimisticState | Optimistic state |\n| useOptimisticTask | Wrap async task to have optimistic result |\n| useUserMedia | Open video and audio streams in browser |\n| useNavigate | Get a function to navigate to any location |\n| useLocationState | Wrap location's state into a react state |\n| useSearchParams | Parse search string to `URLSearchParams` as well as a function to update search |\n| useSearchParam | Get a single search param |\n| useSearchParamAll | Get a single search param as array |\n| useUpdateSearchParams | Get a function to update search params |\n| useSearchParamState | Wrap a single search param into a react state |\n| useWebSocket | Create a web socket connecting to specified url |\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomfe%2Freact-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecomfe%2Freact-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomfe%2Freact-hooks/lists"}