1.0.2 • Published 2 years ago

chocolate-hooks v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🐳 预览

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 代码分析