October 2019
Intermediate to advanced
426 pages
11h 49m
English
The useCounter Hook is going to provide a current count and functions to increment and reset the counter.
Let's create the useCounter Hook now using the following steps:
import { useState, useCallback } from 'react'
export default function useCounter (initialCount = 0) {
const [ count, setCount ] = useState(initialCount)
const increment = useCallback(() => setCount(count ...
Read now
Unlock full access