📌  相关文章
📜  用于钩子的反应测试库 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:12.344000             🧑  作者: Mango

代码示例3
import { useState, useCallback } from 'react'

function useCounter() {
  const [count, setCount] = useState(0)

  const increment = useCallback(() => setCount((x) => x + 1), [])

  return { count, increment }
}

export default useCounter