React hook library, ready to use, written in Typescript.

Overview

usehooks-ts banner


usehooks-ts

React hook library, ready to use, written in Typescript.

Netlify Status Open Source? Yes! Maintained License lerna npm bundle size npm All Contributors


npm i usehooks-ts

Created by Julien Caron and maintained with ❤️ by an amazing team of developers.

🤔 About

Initially, usehooks-ts was a Gatsby powered blog hosted with Github & netlify that publishes easy to understand React Hook code snippets.

But now, it's a monorepo containing:

  • A static website used as hooks documentation (Link).
  • An NPM package containing the hooks library (Link).

If you'd like to submit new post ideas, improve existing posts, or change anything about the website feel free to submit an issue or pull-request.

📖 Summary

Usage

install

npm i usehooks-ts

Then go to the documentation.

🤝 How to Contribute

Thanks for wanting to contribute! It's more than welcome 🤗

Content changes

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.

Fork to submit a Pull Request (PR)

This project use npm Lerna and npm@8 to manage the different packages. Before starting, make sure you have the good system dependencies:

  • node@^16
  • npm@^8

Note: To easily switch node version, consider Node Version Manager (nvm).

Then you can fork, download and install the repository:

# 1) Fork the repository (button in the Github top-right corner)

# 2) Clone the repository
git clone https://github.com/{your_username}/usehooks-ts.git
cd usehooks-ts

# 3) Install dependencies and setup
npm run bootstrap

Create a new hook

# This command will regenerate all the hook boilerplate
npm run plop

# Then develop the hook (aka test:watch)
npm run dev:lib

# Once the hooks is ready
# Launch the documentation website
npm run dev:site

# Before commit: exec types-checking, linters and tests
npm run test

How is structured a hook ?

The hook itself and its unit tests are in the /lib/src/ folder. It's the strict npm run test

📂 lib/src
├── 📂 useHookName
│  ├── 📄 index.ts # used for exports
│  ├── 🧪 useHookName.test.ts # unit tests
│  └── 📄 useHookName.ts # the hook
...

The rest is in the documentation website:

📂 site/src/hooks-doc
├── 📂 useHookName
│  ├── 📄 index.ts # used for exports
│  ├── 📄 useHookName.demo.tsx # working demo
│  └── 📝 useHookName.mdx # the documentation content
...

Note: The demo is used different way:

  • It's displayed on the website to illustrate how to use the hook.
  • It's displayed as an interactive sandbox in the hook page during the dev.
  • It's deployed as a CodeSandbox on build to let final users play with.

Contributors

Big thanks goes to these wonderful people ❤️


Julien

🖋 💻 🎨 🤔

a777med

💻

Nguyen Tien Dat

💻

Elias Cohenca

🖋

João Deroldo

🐛 💻

Nishit

??

Jon Koops

💻

LoneRifle

💻

Viktor

🤔 🐛

Bruno Clermont

💬

yoannesbourg

🤔

Strange2x

🤔

Jason Pickens

🐛

Sel-Vin Kuik

🐛

isaac

🐛

Bruno RZN

💻 👀

Nathan Manceaux-Panot

💻 👀

Dien Vu

🤔

Oleg Kusov

🤔

Matthew Guy

🤔

andrewbihl

🐛

lancepollard

🐛

Mukul Bansal

🐛

Jean-Luc Mongrain sur la Brosse

💻 🤔

Nic

🖋

Dan Wood

💻

jo wendenbuerger

🐛

Andrew Nosenko

🐛

CharlieJhonSmith

💻

Sullivan SENECHAL

🤔

Jason Long

🐛

kxm766

🐛

Quentin

💻 🤔 🖋

Daniel Lazar

💻 🐛

Mark Terrel

🐛 💻

Andreas Herd

🐛

Sonjoy Datta

💻

Ilya Belsky

🐛

James Barrett

💻

AbbalYouness

💻

didriklind

💻

hexp1989

💻

Alvaro Serrano

🖋

Egehan Dülger

💻

PabloLION

🐛 💻

David Sanchez

🐛

Ajay Raja

🐛

Andy Merskin

🤔

This project follows the all-contributors specification (emoji key). Contributions of any kind welcome!

🚗 Roadmap

  • Add new hooks (web3 hooks are welcome!)
  • Develop automated tests for all hooks

📝 License

This project is MIT licensed.

Comments
  • Improve useCountdown

    Improve useCountdown

    Hi again @juliencrn, I just moved back to react. I'm thinking on improving the useCountdown hook. But there would be breaking changes so I want to firstly have a small discussion with you.

    Breaking changes

    In the example usage

      const [count, { start, stop, reset }] = useCountdown({
        seconds: 60,
        interval: 500,
        isIncrement: false,
      })
    
    1. (important) Rename seconds to countNumber or startingCount, countStart, etc. Since it is not the real seconds.
    2. (trivial) Change start, stop, reset to startCountdown, stopCountdown, resetCountdown respectively. The default one would be unclear and make the code harder to maintain.
    3. (trivial) Change interval to intervalMs or intervalMilisec specifying its unit.

    Non-breaking changes

    1. Add a countLimit, or limit, countdownLimit, countEnd, etc. to the setting.

    Outcome & alternative

    The final outcome of this proposal would look like this:

      const [count, { startCountdown, stopCountdown, resetCountdown }] = useCountdown({
        countStart: 60,
        intervalMs: 1000, // add 1000 by default
        countStop: 0, // 0 by default
        isIncrement: false,
      })
    

    Alternative is to make a new useIntervalTimer hook to do the same job but with new name.

    Thanks for reading. What's your opinion?

    opened by PabloLION 13
  • Can I PR new functions?

    Can I PR new functions?

    Hi team. I made a ternary Darkmode (based on this repo) like "dark" | "system" | "light" in a project and I want to use it in another project.
    The best way to share it is to upload it on NPM and GitHub. And I think putting it here might be helpful, as I see you have " Add new hooks" in your roadmap. Questions are:

    1. Is this too trivial to add?
    2. Can I make a PR on this repo?
    3. Do you have a Code of Conduct?

    Thanks.

    opened by PabloLION 13
  • Publish on npm?

    Publish on npm?

    This great repo sounds like a great candidate for publishing on npm for easier updating and security auditing. If someone knows how to set it up, it could also support tree shaking, since each of the hooks is in its own file.

    What do you think?

    opened by vfonic 10
  • Feature/use ternary dark mode

    Feature/use ternary dark mode

    I don't know how to fix my rebase on PR #86 .. So I created a new branch. This is the latest update (repeating PR #86)

    About the SSR problem, I'm going to just apply useMediaQuery, since the useDarkMode is using it as well. We will only need to change one place to fix all.


    The design was for using one button for the minimalist style. You can check it on the top bar of https://www.snippethub.dev/ to see how it works. For me this is better than using an extra button. It keeps the dark/light toggle language and adds a new function. This is how I thought when I wrote the function.

    If we need another toggle, it's better to use the "use dark mode" and a "use system color override".


    The other problem @juliencrn shows in the video is fixed.

    Git workflow: this close #81

    opened by PabloLION 8
  • `useLocalStorage` creates warning in Next.JS

    `useLocalStorage` creates warning in Next.JS

    Next JS prebuilds pages, so when using the useLocalStorage hook it creates a warning link

    Warning: Text content did not match. Server: "Initial Value" Client: "Stored Value"
    
    opened by graygalaxy 7
  • Source maps seem to be broken in 2.7.0

    Source maps seem to be broken in 2.7.0

    Since the version upgrade from 2.6.0 to 2.7.0, getting the following error repeatedly when trying to build a CRA app:

    WARNING in ./node_modules/usehooks-ts/dist/esm/useDebounce/useDebounce.js
    Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
    Failed to parse source map from '/Users/.../node_modules/usehooks-ts/src/useDebounce/useDebounce.ts' file: Error: ENOENT: no such file or directory, open '/Users/.../node_modules/usehooks-ts/src/useDebounce/useDebounce.ts'
    
    opened by yairy 6
  • build(deps): bump file-type from 16.5.3 to 16.5.4 in /site

    build(deps): bump file-type from 16.5.3 to 16.5.4 in /site

    Bumps file-type from 16.5.3 to 16.5.4.

    Release notes

    Sourced from file-type's releases.

    v16.5.4

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 5
  • build(deps): bump terser from 5.9.0 to 5.14.2 in /site

    build(deps): bump terser from 5.9.0 to 5.14.2 in /site

    Bumps terser from 5.9.0 to 5.14.2.

    Changelog

    Sourced from terser's changelog.

    v5.14.2

    • Security fix for RegExps that should not be evaluated (regexp DDOS)
    • Source maps improvements (#1211)
    • Performance improvements in long property access evaluation (#1213)

    v5.14.1

    • keep_numbers option added to TypeScript defs (#1208)
    • Fixed parsing of nested template strings (#1204)

    v5.14.0

    • Switched to @​jridgewell/source-map for sourcemap generation (#1190, #1181)
    • Fixed source maps with non-terminated segments (#1106)
    • Enabled typescript types to be imported from the package (#1194)
    • Extra DOM props have been added (#1191)
    • Delete the AST while generating code, as a means to save RAM

    v5.13.1

    • Removed self-assignments (varname=varname) (closes #1081)
    • Separated inlining code (for inlining things into references, or removing IIFEs)
    • Allow multiple identifiers with the same name in var destructuring (eg var { a, a } = x) (#1176)

    v5.13.0

    • All calls to eval() were removed (#1171, #1184)
    • source-map was updated to 0.8.0-beta.0 (#1164)
    • NavigatorUAData was added to domprops to avoid property mangling (#1166)

    v5.12.1

    • Fixed an issue with function definitions inside blocks (#1155)
    • Fixed parens of new in some situations (closes #1159)

    v5.12.0

    • TERSER_DEBUG_DIR environment variable
    • @​copyright comments are now preserved with the comments="some" option (#1153)

    v5.11.0

    • Unicode code point escapes (\u{abcde}) are not emitted inside RegExp literals anymore (#1147)
    • acorn is now a regular dependency

    v5.10.0

    • Massive optimization to max_line_len (#1109)
    • Basic support for import assertions
    • Marked ES2022 Object.hasOwn as a pure function
    • Fix delete optional?.property
    • New CI/CD pipeline with github actions (#1057)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 5
  • build(deps): bump moment from 2.29.1 to 2.29.4 in /site

    build(deps): bump moment from 2.29.1 to 2.29.4 in /site

    Bumps moment from 2.29.1 to 2.29.4.

    Changelog

    Sourced from moment's changelog.

    2.29.4

    • Release Jul 6, 2022
      • #6015 [bugfix] Fix ReDoS in preprocessRFC2822 regex

    2.29.3 Full changelog

    • Release Apr 17, 2022
      • #5995 [bugfix] Remove const usage
      • #5990 misc: fix advisory link

    2.29.2 See full changelog

    • Release Apr 3 2022

    Address https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 5
  • build(deps): bump gatsby-plugin-mdx from 3.7.0 to 3.15.2 in /site

    build(deps): bump gatsby-plugin-mdx from 3.7.0 to 3.15.2 in /site

    Bumps gatsby-plugin-mdx from 3.7.0 to 3.15.2.

    Release notes

    Sourced from gatsby-plugin-mdx's releases.

    v3.14 (September 2021 #1)

    Welcome to [email protected] release (September 2021 #1)

    This is the final minor release for gatsby v3. Gatsby v4 beta is already published behind the next npm tag and the next stable release will be [email protected]. See what's inside!

    We will keep publishing patches for 3.14.x with hotfixes until 4.0.0 stable is published and at least several weeks after.

    Key highlights of this release:

    Also, check out notable bugfixes.

    Bleeding Edge: Want to try new features as soon as possible? Install gatsby@next and let us know if you have any issues.

    Previous release notes

    Full changelog

    v3.13 (August 2021 #3)

    Welcome to [email protected] release (August 2021 #3)

    Key highlights of this release:

    Also check out notable bugfixes.

    Bleeding Edge: Want to try new features as soon as possible? Install gatsby@next and let us know if you have any issues.

    Previous release notes

    Full changelog

    v3.12 (August 2021 #2)

    Welcome to [email protected] release (August 2021 #2)

    Key highlights of this release:

    ... (truncated)

    Changelog

    Sourced from gatsby-plugin-mdx's changelog.

    3.15.2 (2022-06-02)

    Bug Fixes

    3.15.1 (2022-06-01)

    Note: Version bump only for package gatsby-plugin-mdx

    3.15.0 (2022-05-24)

    🧾 Release notes

    Note: Version bump only for package gatsby-plugin-mdx

    3.14.0 (2022-05-10)

    🧾 Release notes

    Bug Fixes

    3.13.0 (2022-04-26)

    🧾 Release notes

    Note: Version bump only for package gatsby-plugin-mdx

    3.12.1 (2022-04-13)

    Note: Version bump only for package gatsby-plugin-mdx

    3.12.0 (2022-04-12)

    🧾 Release notes

    Note: Version bump only for package gatsby-plugin-mdx

    3.11.1 (2022-03-31)

    Note: Version bump only for package gatsby-plugin-mdx

    3.11.0 (2022-03-29)

    🧾 Release notes

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 5
  • build(deps): bump devcert from 1.2.0 to 1.2.1 in /site

    build(deps): bump devcert from 1.2.0 to 1.2.1 in /site

    Bumps devcert from 1.2.0 to 1.2.1.

    Commits
    Maintainer changes

    This version was pushed to npm by jzetlen, a new releaser for devcert since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 5
  • feat: add reviver support to useLocalStorage

    feat: add reviver support to useLocalStorage

    This adds the optional reviver parameter of JSON.parse to useLocalStorage.

    If this sounds like a feature that should be added, let me know and I'll extend the MR with docu and tests.

    opened by BalzGuenat 0
  • useIntersectionObserver received 2 entries, but only the first (outdated) is taken

    useIntersectionObserver received 2 entries, but only the first (outdated) is taken

    Hi,

    First of all, what a great library of hooks, well done!

    Currently I have an issue with the intersectionObserver. In Chrome (not in FF nor Safari) I receive 2 entries in the callback. The first entry has isIntersecting : false and the second has isIntersecting: true. Im not sure why I receive 2 entries via the Intersection callback, but it seems that the first one is obsolete (outdated) and the latest one is the most up to date with the DOM.

    So I feel that the implementation here https://github.com/juliencrn/usehooks-ts/blob/master/src/useIntersectionObserver/useIntersectionObserver.ts#L20-L22 of just getting the first entry is wrong. I think this should just catch the latest one. As it seems there are situations where the Intersection callback can give more than one result and where latests one is always the one that is up-to-date.

    opened by reinos 0
  • useOnClickOutside hook is fired when clicking inside the watched component

    useOnClickOutside hook is fired when clicking inside the watched component

    Hi :)

    I am using useOnClickOutside to hide a modal when user clicks outside the modal. This work perfectly for 99% of usecases but when I am using React Select library component inside the watched modal and clear the input, it automatically hide the modal and useOnClickOutside is fired.

    Do you have any idea why the hook is triggered?

    The clearButton has a ref but it is a descendent element (inside children) so it should not be triggered.

    Screenshot 2022-12-26 at 09 20 07

    Here is my modal code using your hook

    const Modal: React.FC<ModalProps> = ({
      isShowing,
      closeModal,
      title,
      children,
      description,
    }) => {
      const modalRef = useRef(null)
    
      useOnClickOutside(modalRef, () => {
        closeModal()
      })
    
      useLayoutEffect(() => {
        isShowing && (document.body.style.overflow = "hidden")
        !isShowing && (document.body.style.overflow = "unset")
      }, [isShowing])
    
      return (
        <>
          {isShowing &&
            ReactDOM.createPortal(
              <>
                <div className="Modal__Overlay">
                  <div className="Modal__Wrapper">
                    <div ref={modalRef} className="Modal__Container">
                      <h4 className="Modal__Title">{title}</h4>
                      <p className="Modal__Description">{description}</p>
                      <div className="Modal__Body">{children}</div>
                    </div>
                  </div>
                </div>
              </>,
              document.body
            )}
        </>
      )
    }
    export { Modal }
    

    Thanks a lot :)

    opened by FloorianB 0
  • The `useFetch()` hook is hardcoded to work only with JSON

    The `useFetch()` hook is hardcoded to work only with JSON

    If I try to use useFetch() on some API endpoint that returns plain text or an image, it returns an error because useFetch() is hardcoded to parse the response body as JSON.

    opened by haroldo-ok 0
  • [feature] can you guys please add use-reduction

    [feature] can you guys please add use-reduction

    useReduction minimizes reducer code by automatically creating action creators from your reducer object.

    Write less code by using objects instead of switch statements for defining reducers.

    Debugging is baked in. In debug mode, all dispatched actions are logged to the console.

    code : https://www.npmjs.com/package/use-reduction

    opened by TamjidAhmed10 0
Owner
Julien
passionate self-taught developer, crypto enthusiast #typescript #rust
Julien
A custom react hook to use a dialogs easily.

dialog-hook The dialog-hook is a custom react hook to use a dialog easily. First of all it is necessary to install the package in your project some co

Levy Mateus Macedo 2 Mar 29, 2022
An easy hook to use with expo-calendar library!

useCalendar Hook ?? Updated to Expo SDK45 This is an easy hook to use expo-calendar. It allows you: Get access permission to calendar Open settings to

AtilaDev 12 Nov 1, 2022
ESLint plugin for react-hook-form

eslint-plugin-react-hook-form react-hook-form is an awsome library which provide a neat solution for building forms. However, there are many rules for

Chuan-Tse Kao 37 Nov 22, 2022
An extremely helpful React Hook to trap the focusable elements / Hello Modals! Hello a11y!

react-use-focus-trap Everytime when people implement Modals... ...People forget that pro users as well as users that are permanently or temporarily re

David Lorenz 18 Nov 30, 2022
Small (0.5 Kb) react hook for getting media breakpoints state info in runtime

tiny-use-media Small (0.5 Kb) react hook for getting media breakpoints state info in runtime Usage npm i tiny-use-media --save Adn in your react code

Valeriy Komlev 51 Dec 13, 2022
A reusable react hook that preserves a components semantic accessibility to create a visual block link.

useAccessibleBlockLink is a reusable react hook that preserves a components semantic accessibility to create a visual block link. This hook supports multiple links within the same block.

Wayfair Tech – Incubator 4 Nov 28, 2022
📋 useClipboardApi() is a React Hook that consumes Web Clipboard API.

?? use-clipboard-api useClipboardApi() is a React Hook that consumes Web Clipboard API. Table of Contents Motivation Usage Contributing Bugs and Suges

Helder B. Berto 22 Dec 15, 2022
Open source, production-ready animation and gesture library for React

An open source and production-ready motion library for React on the web. Framer Motion is an open source, production-ready library that's designed for

Framer 17.2k Jan 9, 2023
This hook allows you to isolate and manage the state within the component, reducing rendering operations and keeping the source code concise.

React Hook Component State This hook allows you to isolate and manage the state within the component, reducing rendering operations and keeping the so

Yongwoo Jung 2 May 15, 2022
A hook based project created during 20-Dec week ReactJS workshop

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Nabendu 1 Dec 25, 2021
🌐 Unlimited free google translate component & hook

React Native Translator Preview Introduce Free translate component & hook Never need api key, This library is Unlimited free Support translators Googl

Hyun 34 Dec 18, 2022
Mirrors the functionality of Apollo client's useQuery hook, but with a "query" being any async function rather than GQL statement.

useAsyncQuery Mirrors the functionality of Apollo client's useQuery hook, but with a "query" being any async function rather than GQL statement. Usage

Alasdair McLeay 7 Nov 16, 2022
Script to remove unnecessary properties from package.json on prepublish hook

clean-pkg-json Script to remove unnecessary properties from package.json on prepublish hook. Support this project by ⭐️ starring and sharing it. Follo

hiroki osame 37 Oct 16, 2022
lottery smart contract with react UI, Now ready to interact

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: ya

Akshay Kurhekar 1 Dec 19, 2021
Next-gen, highly customizable content editor for the browser - based on React and Redux and written in TypeScript. WYSIWYG on steroids.

ReactPage ReactPage is a smart, extensible and modern editor ("WYSIWYG") for the web written in React. If you are fed up with the limitations of conte

null 9.1k Jan 6, 2023
NodeRPG - Turn-based RPG written in TypeScript along with Ink and React

NodeRPG Role-Playing Game inside the terminal with Ink and React! Running in your machine Requirements NodeJS TypeScript Yarn* Everything can be done

Felipe Silva 6 Jul 31, 2022
Companion React+TypeScript code for my Intro to TypeScript EmergentWorks workshop, bootstrapped with yarn + create-react-app! ✨

Getting Started with Create React App This project was bootstrapped with Create React App. Companion repository to https://github.com/JoshuaKGoldberg/

Josh Goldberg 2 Dec 21, 2022
Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.

Recoil · Recoil is an experimental set of utilities for state management with React. Please see the website: https://recoiljs.org Installation The Rec

Facebook Experimental 18.2k Jan 8, 2023
A style export tool that live edits and exports code ready to copy / paste

Awesome Title Generator A style export tool that live edits and exports code ready to copy / paste. Features Edits text and live previews it CSS and R

Crhistian de Oliveira 19 Oct 7, 2022