Skip to content

Instantly share code, notes, and snippets.

@andyfaizan
Created April 11, 2023 12:21
Show Gist options
  • Save andyfaizan/8a916737eb8f00a3272253af48d4c6ff to your computer and use it in GitHub Desktop.
Save andyfaizan/8a916737eb8f00a3272253af48d4c6ff to your computer and use it in GitHub Desktop.
// Parent.jsx
class Parent extends React.Component {
constructor() {
super();
console.log("Parent constructor"); // 1
}
componentDidMount() {
console.log("Parent CDM"); // 2
}
render() {
return <Child />;
}
}
// Child.jsx
class Child extends React.Component {
constructor() {
super();
console.log("Child constructor"); // 3
}
componentDidMount() {
console.log("Child CDM"); // 4
}
render() {
return <div />;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment