Created
July 13, 2021 20:30
-
-
Save Davidegloh/75645b0338130ce339f64f30223f825e to your computer and use it in GitHub Desktop.
[toggle]#toggle
This file contains 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 { useState } from "react"; | |
import Item from "./Components/Item/Item"; | |
function App() { | |
const [toggle, setToggle] = useState(true); | |
const changeState = () => { | |
setToggle(!toggle); | |
}; | |
return ( | |
<div className="App"> | |
{toggle ? <h1>Le state est True</h1> | |
:<h1>Le state est False</h1> } | |
<button onClick={changeState}>Changer le state</button> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment