require('../../sass/board/grid.scss'); import { Component } from 'react'; import { connect } from 'react-redux'; import GridCell from './grid-cell.component'; import * as Actions from '../../actions/board/grid.actions'; import { SETTINGS } from '../../App'; export default class Grid extends Component { componentDidMount(n) { this.props.dispatch(Actions.generateValues(SETTINGS.GRID_WIDTH * SETTINGS.GRID_HEIGHT, 1)); }; render() { const { values } = this.props; const cells = []; let i; for (let x = 0; x < SETTINGS.GRID_WIDTH; x++) { for (let y = 0; y < SETTINGS.GRID_HEIGHT; y++) { i = y * SETTINGS.GRID_WIDTH + x; cells.push(); } } return (
{cells}
); }; }; const select = (state) => { return { values: state.grid } }; export default connect(select)(Grid);