MCPcopy Create free account
hub / github.com/SuboptimalEng/coding-tutorials / App

Function App

_templates/01-basic/src/App.tsx:10–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8import { decrement, increment } from './redux/counterSlice';
9
10function App() {
11 useEffect(() => {
12 applyTheme(baseTheme);
13 }, []);
14
15 const { value } = useAppSelector((state) => state.counter);
16 const dispatch = useAppDispatch();
17
18 return (
19 <div className="App">
20 <header className="App-header">
21 <div className="bg-secondary text-text-base flex flex-col place-items-center">
22 <div className="flex">
23 <div
24 onClick={() => applyTheme(baseTheme)}
25 className="border rounded p-2 m-2"
26 >
27 Base theme
28 </div>
29 <div
30 onClick={() => applyTheme(darkTheme)}
31 className="border rounded p-2 m-2"
32 >
33 Dark theme
34 </div>
35 </div>
36 <img src={logo} className="App-logo w-60" alt="logo" />
37 <div className="border rounded p-2 mb-4">Learn React</div>
38 <div className="flex w-full place-items-center justify-center space-x-2 mb-2">
39 <div
40 className="border p-2 rounded"
41 onClick={() => dispatch(decrement())}
42 >
43 -
44 </div>
45 <div>{value}</div>
46 <div
47 className="border p-2 rounded"
48 onClick={() => dispatch(increment())}
49 >
50 +
51 </div>
52 </div>
53 </div>
54 </header>
55 </div>
56 );
57}
58
59export default App;

Callers

nothing calls this directly

Calls 2

applyThemeFunction · 0.90
useAppDispatchFunction · 0.90

Tested by

no test coverage detected