this within component did mount replace hooks code example
Example 1: react hooks componentdidmount
// import useEffect from 'react';
useEffect(() => {
// your code here
}, []);
Example 2: componentdidmount in hooks
useEffect(() => {
// Your code here
}, []);