1
import React from 'react';
2
import { useState } from 'react';
3
function App() {
3
export default function App() {
4
const [count, setCount] = useState(0);
4
const [count, setCount] = useState(0);
5
const [theme, setTheme] = useState('dark');
6
7
return (
8
<div>
8
<div className={theme}>
9
<button onClick={() => setTheme(t => t === 'dark' ? 'light' : 'dark')}>
10
Toggle Theme
11
</button>
12
<h1>Count: {count}</h1>
13
<button onClick={() => setCount(c => c + 1)}>+</button>
14
</div>
15
);
16
}