Skip to content

ChocolateUI/chocolate-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chocolate-hooks
chocolate-hooks npm chocolate-hooks netlify

🍫 Chocolate-Hooks

一个 React Hooks 库,提升开发效率

🐳 预览

chocolate-hooks

⚡ 安装

使用 npm

npm install chocolate-hooks --save

使用 yarn

yarn add chocolate-hooks

☄️ 如何使用

import React from 'react'
import { useCountDown } from 'chocolate-hooks'

export const Example = () => {
  const [date, setDate] = useState(undefined)
  const [dateString, _] = useCountDown({
    endTime: date,
    format: 'dd天hh小时mm分ss秒',
    diff: 1000,
    onEnd: () => console.log('end'),
  })

  useEffect(() => {
    setDate(Date.now() + 2 * 24 * 60 * 60 * 1000)
  }, [])

  return <>{dateString}</>
}

🔨 部署 Deploy

  • 集成 GitHub Action 自动化部署,同时支持 CodeQL 代码分析