Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mfrancois3k/268de8ea034c9f680c989aef562acec6 to your computer and use it in GitHub Desktop.
Save mfrancois3k/268de8ea034c9f680c989aef562acec6 to your computer and use it in GitHub Desktop.
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