Untitled

mail@pastecode.io avatar
unknown
plain_text
13 days ago
439 B
2
Indexable
Never
import { useEffect } from "react";



function Test({name}) {

  // component did Mount
  useEffect(() => {
    // code
  }, []);

  // component did update
  useEffect(() => {
    // code
  }, [name]);

  // component did unmount
  useEffect(() => {
    return () => {
      alert("Un Mounted");
    };
  }, []);

  return (
    <div>
      <h2>Name : {name}</h2>
    </div>
  );
}

 export default Test;

Leave a Comment