使用 npm
npm i react-7h-hooks --save
使用 yarn
yarn add react-7h-hooks
import React from 'react'
import { useTrimInput } from 'react-7h-hooks'
export const Example = () => {
const [trimValue, setTrimValue] = useTrimInput()
const [fullTrimValue, setFullTrimValue] = useTrimInput(true)
return (
<>
<input
value={trimValue}
onChange={setTrimValue}
/>
<input
value={fullTrimValue}
onChange={setFullTrimValue}
/>
</>
)
}
https://react-7h-hooks.netlify.com/
- swr 网络请求
- react-use 常用的一些基础 hooks
- @umijs/hooks 乌米提供的一些实用的高级 hooks