October 2019
Intermediate to advanced
426 pages
11h 49m
English
The useMergeState Hook works similarly to the useState Hook. However, it does not replace the current state, but instead merges the current state with the new state, just like this.setState() works in React class components.
The Merge State Hook returns the following objects:
For example, let's consider the following component:
import React, { useState } from 'react'
export default function MergeState () { const [ state, setState ] = useState({ loaded: true, counter: ...Read now
Unlock full access