const CounterComponent = () => {
const {counter1, setCounter1, counter2, setCounter2 } = useContext(CounterContext)
return(
<React.Fragment>
<button onClick={() => setCounter1((counter) => counter + 1)}>Click Counter {counter1}</button>
<button onClick={() => setCounter2((counter) => counter + 1)}>Click Counter {counter2}</button>
</React.Fragment>
)
}
const CounterComponent = () => {
const {counter1, setCounter1, counter2, setCounter2 } = useContext(CounterContext)
return(
<React.Fragment>
<button onClick={() => setCounter1((counter) => counter + 1)}>Click Counter {counter1}</button>
<button onClick={() => setCounter2((counter) => counter + 1)}>Click Counter {counter2}</button>
</React.Fragment>
)
}