easy-hooks-ts
TypeScript icon, indicating that this package has built-in type declarations

0.8.1 • Public • Published

easy-hooks-ts

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

License: MIT NPM version


Status

This project is “semi-maintained” 😅

I don't have the bandwidth right now to look into edge-case issues or help troubleshoot, but I plan on keeping it up-to-date with major React releases, and fixing issues that are both serious and common.

Feel free to create a pull request or issues for features, bug fixes or improvements.


Installation

Package can be added using yarn:

yarn add easy-hooks-ts

Or, use NPM:

npm install easy-hooks-ts

Demo

🛠️


Examples

Use easy-hooks-ts

import { useToggle } from 'easy-hooks-ts'
 
export const Component = () => {
  const [value, toggle, setValue] = useToggle()
 
  const customToggle = () => setValue((x: boolean) => !x)
 
  return (
    <>
      <p>
        Value is <code>{value.toString()}</code>
      </p>
      <button onClick={() => setValue(true)}>set true</button>
      <button onClick={() => setValue(false)}>set false</button>
      <button onClick={toggle}>toggle</button>
      <button onClick={customToggle}>custom toggle</button>
    </>
  )
}

API Documentation

🛠️

Package Sidebar

Install

npm i easy-hooks-ts

Weekly Downloads

1

Version

0.8.1

License

MIT

Unpacked Size

8.58 kB

Total Files

7

Last publish

Collaborators

  • mmartinsoliv