-
-
Save Mohammad-Faisal/9f9efea49e187188a5917f20d2fbb76a to your computer and use it in GitHub Desktop.
This file contains 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 React, { useState } from "react"; | |
export const TestMemo = () => { | |
const [userName, setUserName] = useState("faisal"); | |
const [count, setCount] = useState(0); | |
const increment = () => setCount((count) => count + 1); | |
return ( | |
<> | |
<ChildrenComponent userName={userName} /> | |
<button onClick={increment}> Increment </button> | |
</> | |
); | |
}; | |
const ChildrenComponent =({ userName }) => { | |
console.log("rendered", userName); | |
return <div> {userName} </div>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment