built-to-spell/src/app.tsx

28 lines
544 B
TypeScript
Raw Normal View History

2021-01-04 22:20:46 -05:00
import React, {
FunctionComponent,
useContext,
} from 'react';
import GameView from './game-view.tsx';
import SetupView from './setup-view';
import { StoreContext } from './store';
const App: FunctionComponent = () => {
const { state } = useContext(StoreContext);
const { view } = state;
return (
<div className="mx-auto max-w-sm min-h-screen p-2 bg-white shadow-lg">
{view === 'GAME' && (
<GameView />
)}
{view === 'SETUP' && (
<SetupView />
)}
</div>
);
};
export default App;