Skip to content

Instantly share code, notes, and snippets.

@Showrin
Created April 5, 2021 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Showrin/db31707e53d4d118ed4ea052a24f47e5 to your computer and use it in GitHub Desktop.
Save Showrin/db31707e53d4d118ed4ea052a24f47e5 to your computer and use it in GitHub Desktop.
import { StrictMode } from "react";
import ReactDOM from "react-dom";
const rootElement = document.getElementById("root");
const isTure = true;
const isFalse = false;
const isUndefined = undefined;
const isNull = null;
function App(props) {
return <div className="App">{props.children}</div>;
}
ReactDOM.render(
<StrictMode>
<App>
<h1>Hello, I am a child</h1>
<h2>I am also a child</h2>
{isTure && <div>I will be rendered when the first statement is true</div>}
{isFalse && <h2>I will be rendered when the first statement is true</h2>}
{isUndefined && <h2>I will be rendered when the first statement is true</h2>}
{isNull && <h2>I will be rendered when the first statement is true</h2>}
</App>
</StrictMode>,
rootElement
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment