Spaces:
No application file
No application file
Update src/App.jsx
#8
by
hotboxxgenn - opened
- src/App.jsx +30 -5
src/App.jsx
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
|
|
|
|
|
| 1 |
function App() {
|
|
|
|
|
|
|
| 2 |
return (
|
| 3 |
-
<div>
|
| 4 |
-
<h1>Welcome to React</h1>
|
| 5 |
-
<p>Edit <code>src/App.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
</div>
|
| 7 |
-
)
|
| 8 |
}
|
| 9 |
|
| 10 |
-
export default App
|
|
|
|
| 1 |
+
import { useState } from 'react'
|
| 2 |
+
|
| 3 |
function App() {
|
| 4 |
+
const [count, setCount] = useState(0)
|
| 5 |
+
|
| 6 |
return (
|
| 7 |
+
<div style={{ padding: '20px', textAlign: 'center' }}>
|
| 8 |
+
<h1>Welcome to Your React App</h1>
|
| 9 |
+
<p>Edit <code>src/App.jsx</code> and save to reload.</p>
|
| 10 |
+
|
| 11 |
+
<div style={{ marginTop: '20px' }}>
|
| 12 |
+
<button
|
| 13 |
+
onClick={() => setCount((count) => count + 1)}
|
| 14 |
+
style={{
|
| 15 |
+
padding: '10px 20px',
|
| 16 |
+
fontSize: '16px',
|
| 17 |
+
backgroundColor: '#007bff',
|
| 18 |
+
color: 'white',
|
| 19 |
+
border: 'none',
|
| 20 |
+
borderRadius: '5px',
|
| 21 |
+
cursor: 'pointer'
|
| 22 |
+
}}
|
| 23 |
+
>
|
| 24 |
+
Count is: {count}
|
| 25 |
+
</button>
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<p style={{ marginTop: '20px', color: '#666' }}>
|
| 29 |
+
Click the button to test React state management
|
| 30 |
+
</p>
|
| 31 |
</div>
|
| 32 |
+
)
|
| 33 |
}
|
| 34 |
|
| 35 |
+
export default App
|