// @flow import { Button, Text } from '@blueprintjs/core'; import type { List } from 'immutable'; import React from 'react'; import { connect } from 'react-redux'; import { Flex } from 'reflexbox'; import type { Game } from '../../models/games'; import { actions, getAllGames } from '../../redux/games'; type GameListProps = { games: List, joinGame: (gameId: string) => void, }; const GameListPresenter = ({ games, joinGame }: GameListProps) => (
{games.map((game: Game, index: number) => { return ( {game.name} ); })}
); const mapStateToProps = state => ({ games: getAllGames(state.get('games')), }); const mapDispatchToProps = { joinGame: actions.requestJoinGame, }; export const GameList = connect(mapStateToProps, mapDispatchToProps)(GameListPresenter);