-
Notifications
You must be signed in to change notification settings - Fork 48
Time - Haben #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Time - Haben #37
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,14 +4,28 @@ import Square from './Square'; | |
| import PropTypes from 'prop-types'; | ||
|
|
||
|
|
||
| const generateSquareComponents = (squares, onClickCallback) => { | ||
| // Complete this for Wave 1 | ||
| const generateSquareComponents = (squares, onClickCallback, player) => { | ||
|
|
||
| const squareComponents = squares.map((row) => { | ||
| return row.map(({id, value}) => { | ||
| return ( | ||
| <Square | ||
| id={id} | ||
| value={value} | ||
| onClickCallback={onClickCallback} | ||
| player={player} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a big issue but I wanted to point out that player is being passed as a prop but isn't ever used by the |
||
| key={id} | ||
| /> | ||
|
|
||
| ); | ||
| }); | ||
| }); | ||
| return squareComponents; | ||
| } | ||
|
|
||
| const Board = ({ squares, onClickCallback }) => { | ||
| const squareList = generateSquareComponents(squares, onClickCallback); | ||
| console.log(squareList); | ||
| const Board = ({ squares, onClickCallback, player }) => { | ||
| const squareList = generateSquareComponents(squares, onClickCallback, player); | ||
|
|
||
| return <div className="grid" > | ||
| {squareList} | ||
| </div> | ||
|
|
@@ -22,11 +36,12 @@ Board.propTypes = { | |
| PropTypes.arrayOf( | ||
| PropTypes.shape({ | ||
| id: PropTypes.number.isRequired, | ||
| value: PropTypes.string.isRequired | ||
| value: PropTypes.string.isRequired, | ||
| }) | ||
| ) | ||
| ), | ||
| onClickCallback: PropTypes.func.isRequired, | ||
| player: PropTypes.string.isRequired | ||
| }; | ||
|
|
||
| export default Board; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is clever!