Skip to content

00feng00/react-ihooks

Repository files navigation

react-ihooks

文档预览

安装 react-ihooks

$ npm i react-ihooks

useDocumentTitle

示例代码

import React from 'react';
import { useDocumentTitle } from 'react-ihooks';

export default () => {
  useDocumentTitle('页面标题');

  return (
    <div>
      <p>为页面设置标题</p>
    </div>
  );
};

useDebounce

示例代码

import React, { useState } from 'react';
import { useDebounce } from 'react-ihooks';

export default () => {
  const [value, setValue] = useState<string>('');
  const debouncedValue = useDebounce(value, { wait: 200 });

  return (
    <div>
      <input
        value={value}
        onChange={(e) => setValue(e.target.value)}
        placeholder="请输入信息"
        style={{ width: 180 }}
      />
      <p style={{ marginTop: 16 }}>DebouncedValue: {debouncedValue}</p>
    </div>
  );
};

技术交流

About

函数工具库

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published