Created
October 19, 2024 08:35
-
-
Save calloc134/48fd096f35492a43f928cf0757297277 to your computer and use it in GitHub Desktop.
bakahook
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 { useState } from "react"; | |
| import "./App.css"; | |
| function App() { | |
| const random = Math.random(); | |
| if (random > 0.5) { | |
| const [count1, setCount1] = useState(0); | |
| const [count2, setCount2] = useState(123); | |
| return ( | |
| <div> | |
| <h1>If Mode</h1> | |
| <a>count is {count1}</a> | |
| <br /> | |
| <a>name is {count2}</a> | |
| <br /> | |
| <button onClick={() => setCount1((count) => count + 1)}>count</button> | |
| </div> | |
| ); | |
| } else { | |
| const [name, setName] = useState(0); | |
| const [count, setCount] = useState(0); | |
| return ( | |
| <div> | |
| <h1> Else Mode</h1> | |
| <a>count is {count}</a> | |
| <br /> | |
| <a>name is {name}</a> | |
| <br /> | |
| <button onClick={() => setCount((count) => count + 1)}>count</button> | |
| </div> | |
| ); | |
| } | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment