Created
November 25, 2020 10:51
-
-
Save kristijan-pajtasev/b481fe9557dfe813323404ba417d4f6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ( | |
| <div> | |
| <Counter onChange={setFirstCounter} /> | |
| <Counter onChange={setSecondCounter} /> | |
| </div> | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment