Hooks: The Best React Hooks Library for Browser and SSR

 A high-quality & reliable React Hooks library.

✨ Features

  • Easy to learn and use
  • Supports SSR
  • Special treatment for functions, avoid closure problems
  • Contains a large number of advanced Hooks that are refined from business scenarios
  • Contains a comprehensive collection of basic Hooks
  • Written in TypeScript with predictable static types

📦 Install

$ npm install --save ahooks
# or
$ yarn add ahooks
# or
$ pnpm add ahooks

🔨 Usage

import { useRequest } from 'ahooks';

💻 Online Demo

Edit demo for ahooks

🤝 Contributing

$ git clone git@github.com:alibaba/hooks.git
$ cd hooks
$ pnpm run init
$ pnpm start

Open your browser and visit http://127.0.0.1:8000

We welcome all contributions, please read our CONTRIBUTING.MD first, let's build a better hooks library together.

.babelrc

{
  "presets": [["@babel/env"], "@babel/react"],
  "plugins": ["@babel/plugin-transform-runtime"]
}

.coveralls.yml

service_name: travis-pro
repo_token: dO6l2UfWXIPwCzK3lmEUKQyQsfzXZUZml

.editorconfig

# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

.eslintrc.js

const fabric = require('@umijs/fabric');

module.exports = {
  ...fabric.default,
  rules: {
    ...fabric.default.rules,
    'no-restricted-syntax': 'off',
    'no-plusplus': 'off',
    'no-console': 'off',
    'no-underscore-dangle': 'off',
    'consistent-return': 'off',
    '@typescript-eslint/ban-ts-ignore': 'off',
    '@typescript-eslint/no-object-literal-type-assertion': 'off',
    '@typescript-eslint/no-parameter-properties': 'off',
    'consistent-return': 'off',
    'import/no-useless-path-segments': 'off',
    'no-unused-expressions': 'off',
    'react-hooks/rules-of-hooks': 'error',
    'react-hooks/exhaustive-deps': 'off',
    'no-await-in-loop': 'off',
    'no-constant-condition': ['warn', { checkLoops: false }],
  },
  plugins: [...fabric.default.plugins, 'react-hooks'],
  parserOptions: {
    ...fabric.default.parserOptions,
    project: './packages/**/tsconfig.json',
  },
};

.gitignore

dist
es
lib
.docz
node_modules
.history
.idea
.vscode
coverage
.doc
.DS_Store
.umi
.umi-production
page
lerna-debug.log
tsconfig.tsbuildinfo
packages/hooks/README.md
yarn-error.log
package-lock.json
metadata.json
.eslintcache

Download details:

Author: alibaba
Source: https://github.com/alibaba/hooks

License: MIT license

#reacthook #react 

Hooks: The Best React Hooks Library for Browser and SSR
1.15 GEEK