to do: unify state, lift components to app level
This commit is contained in:
24
src/App.tsx
24
src/App.tsx
@@ -1,10 +1,34 @@
|
||||
import Gameboard from './components/Gameboard/Gameboard'
|
||||
import './App.css'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
|
||||
function App() {
|
||||
const [state, setState] = useState({
|
||||
gameboard: null,
|
||||
store: null,
|
||||
players: null,
|
||||
round: 0
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (!state.players) {
|
||||
console.log('no players!');
|
||||
}
|
||||
}, []);
|
||||
|
||||
const getGameboard = useCallback(() => {
|
||||
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<Gameboard />
|
||||
{/*
|
||||
|
||||
< INVENTORY />
|
||||
< PLAYERS />
|
||||
|
||||
*/}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ export default function Gameboard() {
|
||||
useEffect(() => {
|
||||
setView(
|
||||
<>
|
||||
<CardRow tier={1} cards={state.cardRows.tierOne} />
|
||||
<CardRow tier={2} cards={state.cardRows.tierTwo} />
|
||||
<CardRow tier={3} cards={state.cardRows.tierThree} />
|
||||
<CardRow tier={2} cards={state.cardRows.tierTwo} />
|
||||
<CardRow tier={1} cards={state.cardRows.tierOne} />
|
||||
</>
|
||||
)
|
||||
}, [state.cardRows]);
|
||||
@@ -89,7 +89,7 @@ export default function Gameboard() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Gameboard</h1>
|
||||
<h1>SPLENDOR</h1>
|
||||
{ view }
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user