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 Gameboard from './components/Gameboard/Gameboard'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
|
|
||||||
function App() {
|
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 (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Gameboard />
|
<Gameboard />
|
||||||
|
{/*
|
||||||
|
|
||||||
|
< INVENTORY />
|
||||||
|
< PLAYERS />
|
||||||
|
|
||||||
|
*/}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ export default function Gameboard() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setView(
|
setView(
|
||||||
<>
|
<>
|
||||||
<CardRow tier={1} cards={state.cardRows.tierOne} />
|
|
||||||
<CardRow tier={2} cards={state.cardRows.tierTwo} />
|
|
||||||
<CardRow tier={3} cards={state.cardRows.tierThree} />
|
<CardRow tier={3} cards={state.cardRows.tierThree} />
|
||||||
|
<CardRow tier={2} cards={state.cardRows.tierTwo} />
|
||||||
|
<CardRow tier={1} cards={state.cardRows.tierOne} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}, [state.cardRows]);
|
}, [state.cardRows]);
|
||||||
@@ -89,7 +89,7 @@ export default function Gameboard() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>Gameboard</h1>
|
<h1>SPLENDOR</h1>
|
||||||
{ view }
|
{ view }
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user