-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
40 lines (35 loc) · 796 Bytes
/
App.tsx
File metadata and controls
40 lines (35 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from 'react';
import { AppProvider, useApp } from './context/AppContext';
import { AppRoute } from './types';
import Home from './pages/Home';
import Scan from './pages/Scan';
import Read from './pages/Read';
const AppContent: React.FC = () => {
const { route } = useApp();
// Simple Router based on state
const renderPage = () => {
switch (route) {
case AppRoute.HOME:
return <Home />;
case AppRoute.SCAN:
return <Scan />;
case AppRoute.READ:
return <Read />;
default:
return <Home />;
}
};
return (
<div className="h-full w-full">
{renderPage()}
</div>
);
};
const App: React.FC = () => {
return (
<AppProvider>
<AppContent />
</AppProvider>
);
};
export default App;