Created
January 7, 2021 06:18
-
-
Save robzlabz/47f70079ad4a7eb201b2ebb53cd0e08a 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 from "react"; | |
// di functional component menggunakan useEffect dengan argumen kedua [] array kosong | |
const FunctionalComponent = () => { | |
React.useEffect(() => { | |
console.log("Aku Dijalankan"); | |
}, []); | |
return <h1>Halo, Selamat Pagi</h1>; | |
}; | |
// contoh class component | |
class ClassComponent extends React.Component { | |
componentDidMount() { | |
console.log("Aku Dijalankan"); | |
} | |
render() { | |
return <h1>Halo, Selamat Pagi</h1>; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment