Skip to content

Instantly share code, notes, and snippets.

@Mohammad-Faisal
Last active April 22, 2022 03:15
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