📅  最后修改于: 2022-03-11 15:04:12.344000             🧑  作者: Mango
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