to do: unify state, lift components to app level

This commit is contained in:
2022-07-18 20:12:40 -05:00
parent 80bc389f6f
commit 9959cbf4b1
2 changed files with 27 additions and 3 deletions

View File

@@ -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>
)
}

View File

@@ -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>
)