Local state management
When talking about local state management, we're referring to application state that is component-scoped. We can summarize that concept with an elementary Counter
component:
import React, { useState } from "react"; function Counter({ initialCount = 0 }) { const [count, setCount] = useState(initialCount); return ( <div> <b>Count is: {count}</b><br /> <button onClick={() => setCount(count + 1)}> Increment + </button> <button onClick={() => setCount(count - 1)}> Decrement - </button> </div> ) } export default Counter;
When we click...