Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import {useEffect, useState} from "react";
import Counter from "./Counter";
function ConditionalEffects() {
const [firstCounter, setFirstCounter] = useState(0);
const [secondCounter, setSecondCounter] = useState(0);
useEffect(() => {
console.log("updated first counter")
}, [firstCounter]);
return (
<Counter onChange={setFirstCounter} />
<Counter onChange={setSecondCounter} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment