@tntd/hooks

1.0.5 • Public • Published

react hooks组件库

安装

npm install @tntd/hooks --save
import { Button, Switch } from 'antd';
import { useToggle } from "@tntd/hooks";

export default () => {
    const [state, { toggle }] = useToggle();

    return (
        <div>
        <p>
            Effects:
            <Switch checked={state} onChange={toggle} />
        </p>
        <p>
            <Button type="default" onClick={() => toggle()}>Toggle</Button>
            <Button type="danger" onClick={() => toggle(false)}>Toggle False</Button>
            <Button type="primary" onClick={() => toggle(true)}>Toggle True</Button>
        </p>
        </div>
  );
}

支持按需加载(推荐)

安装babel插件

npm install babel-plugin-tnt --save-dev

.babelrc中添加如下配置即可

"plugins": [
    [
      "babel-plugin-tnt",
      {
        "library": ["@tntd/hooks"]
      }
    ],
]

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.5
    1
    • latest

Version History

Package Sidebar

Install

npm i @tntd/hooks

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

237 kB

Total Files

134

Last publish

Collaborators

  • kobingogo
  • mcfly001
  • z337198954
  • td-tnt
  • bruceliu68
  • bernardzhang
  • mizy
  • zhouzefei
  • xiaofei.wang
  • anthonyli
  • popoqaq
  • ezios