Last active
June 16, 2021 10:50
-
-
Save SysCall97/e4cebd15079862c25f26ebeef90fbf63 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
const Parent = () => { | |
const [count, setCount] = useState<number>(0); | |
const printFunction = (text: string) => { | |
console.log(text); | |
} | |
// some other functions | |
return ( | |
<div > | |
<div> | |
<span style={{marginRight: 10}}>{count}</span> | |
<button onClick={() => setCount((prev: number) => prev + 1)}>add parent count</button> | |
</div> | |
/* some jsx element*/ | |
<Child callback={printFunction} /> | |
/* some jsx element*/ | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment