October 2019
Intermediate to advanced
426 pages
11h 49m
English
The usePrevious Hook is a simple Hook that lets us get the previous value of a prop or Hook value. It will always store and return the previous value of any given variable, and it works as follows:
import React, { useState } from 'react'import { usePrevious } from 'react-hookedup'
export default function UsePrevious () { const [ count, setCount ] = useState(0)
const prevCount = usePrevious(count)
Read now
Unlock full access