Building our 1st COMPONENT
CREATING A COMPONENT IS SIMILAR TO CREATING A FUNCTION.
function Title() {
return <h2>TITLE!!!!</h2>;
}
TO INSERT MULTIPLE TAGS A DIV BLOCK CAN BE USED AND WE EMBED THE REQUIRED HTML TAGS INTO IT.
import("./App.css");
function Title() {
return <h2>TITLE!!!!</h2>;
}
function Description() {
return <h5>This is the description..</h5>;
}
function App() {
return (
<div>
<Title />
<Description />
<Title />
<Description />
</div>
);
}
export default App;
GENERALLY, ALL THE COMPONENTS ARE WRITTEN IN A SEPERATE FILE AND EXPORTED TO THE APP.JSX


Comments
Post a Comment