npm i usehooks-ts
useBoolean()
useClickAnyWhere()
useCopyToClipboard()
useCountdown()
useCounter()
useDarkMode()
useDebounce()
useDebounceCallback()
useDebounceValue()
useDocumentTitle()
useEventCallback()
useEventListener()
useHover()
useIntersectionObserver()
useInterval()
useIsClient()
useIsMounted()
useIsomorphicLayoutEffect()
useLocalStorage()
useLockedBody()
useMap()
useMediaQuery()
useOnClickOutside()
useReadLocalStorage()
useResizeObserver()
useScreen()
useScript()
useSessionStorage()
useStep()
useTernaryDarkMode()
useTimeout()
useToggle()
useUnmount()
useWindowSize()
Thanks for wanting to contribute! It's more than welcome π€
Most content changes (like fixing a typo) can be made without cloning the repository. Simply locate the file you wish to change in the GitHub UI, and click the little edit icon to make your change directly on the GitHub website.
If you need to make any other substantial changes, then follow the project setup steps below.
Before starting, make sure you have the good system dependencies:
node@16.x
pnpm@^8
Note: To easily switch node version, consider Node Version Manager (nvm).
Then fork the repository, clone it and install.
git clone https://github.com/{your_username}/usehooks-ts.git
cd usehooks-ts
pnpm install
# This command generates boilerplate for new hooks.
# Skip if updating an existed hook.
pnpm gen-hook
# start working
pnpm dev
# or
pnpm dev --filter=usehooks-ts # jest --watch
pnpm dev --filter=www # next dev
# Develop
pnpm build
pnpm lint
pnpm test
π ./packages/usehooks-ts
βββ π useHookName
β βββ π useHookName.demo.tsx # working demo
β βββ π useHookName.mdx # the documentation content
β βββ π§ͺ useHookName.test.ts # unit tests
β βββ π useHookName.ts # the hook
β βββ π index.ts
...
When the usehooks-ts
is compiled, only the necessary files are used.
The other files are copied in the documentation website.
Note: The demo is used in a different way:
- It's displayed on the website to illustrate how to use the hook.
- It's deployed as a CodeSandbox on build to let final users play with.
Big thanks go to all our backers!
Sentry |
KATT |
Adhi Ravishankar |
great-work-told-is |
Big thanks go to all our contributors!
This project follows the all-contributors specification (emoji key). Contributions of any kind welcome!
This project is MIT licensed.