Last active
September 6, 2020 14:42
-
-
Save codegagan/cfb1a8934fee950dfd67043557fd61e1 to your computer and use it in GitHub Desktop.
Test conditional rendering based on state
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, { useState } from "react"; | |
export default function ConditionalComponent() { | |
const [loading, setLoading] = useState(false); | |
return ( | |
<div> | |
<h1>Conditional test</h1> | |
{loading ? <p>Loading....</p> : <p>Page loaded successfully</p>} | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment