Skip to content

Instantly share code, notes, and snippets.

@Davidegloh
Created July 13, 2021 20:30
Show Gist options
  • Save Davidegloh/75645b0338130ce339f64f30223f825e to your computer and use it in GitHub Desktop.
Save Davidegloh/75645b0338130ce339f64f30223f825e to your computer and use it in GitHub Desktop.
[toggle]#toggle
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