Implement a super basic UI to display the game list, and a button to create a game.
Backend websockets and handlers were already implemented, just hooked the UI into that backend.
Known issues
The game owner is a whole player object in the state store. So the data shows as an object on the screen and we get a proptype warning because the game list item element expects a game owner string.
Probably should normalize our redux store and extract the player object into its own slice of state, and just store their ID as the game owner.
Write a selector function that we can use to select the right shape of data (game list items + game owner username not the whole object)
Write a selector method that takes state an an param, and returns the right shape of data like [1]
Put that function in the reducer file and export it [1]
Import it into the container and use it in the mapStateToProps like [2]
Even though there is a valid list of games, we don't send the websocket event to the players until someone creates a game.
Should probably make the backend push the websocket event with game list data uppon connect using the getGameList handler
[1]
export const mySelector = (state) => { // select things from the state.gameList and state.players }
[2]
import { mySelector } from '../reducer';
const mapStateToProps = state => ({
gameList: mySelector(state),
});
Implement a super basic UI to display the game list, and a button to create a game. Backend websockets and handlers were already implemented, just hooked the UI into that backend.
Known issues
mapStateToProps
like [2][1]
[2]