Forked from bedirhankaradogan/react-functional-component.jsx
Created
March 21, 2022 17:03
-
-
Save mfrancois3k/268de8ea034c9f680c989aef562acec6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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"; | |
import ReactDOM from "react-dom"; | |
function FunctionalComponent() { | |
return "I'm the functional component"; | |
} | |
const FunctionalComponentWithArrowFunction = () => { | |
return "I'm the functional component"; | |
} | |
const FunctionalComponentReturnsHtml = () => { | |
return <div>{"I'm the functional component"}</div>; | |
} | |
const FunctionalComponentReturnsMultilineHtml = () => { | |
return ( | |
<div> | |
{"I'm the functional component"} | |
</div> | |
); | |
} | |
const RenderFunctionalComponents = () => { | |
return ( | |
<div> | |
<FunctionalComponent /> | |
<FunctionalComponentWithArrowFunction /> | |
<FunctionalComponentReturnsHtml /> | |
<FunctionalComponentReturnsMultilineHtml /> | |
</div> | |
); | |
} | |
const rootElement = document.getElementById("root"); | |
ReactDOM.render(<RenderFunctionalComponents />, rootElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment