Skip to content
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

Consider automating renderSquare calls #23

Open
ZooeyMiller opened this issue May 25, 2018 · 1 comment
Open

Consider automating renderSquare calls #23

ZooeyMiller opened this issue May 25, 2018 · 1 comment
Assignees

Comments

@ZooeyMiller
Copy link

ZooeyMiller commented May 25, 2018

at

{this.renderSquare(0)}
you are manually writing renderSquare and an index, in React you can return an array of components to be rendered, so you could use Array.from({length: lengthOfArrayYouWant}), aMapFunction) to create an array and map it immediately with your renderSquare calls.

or even Array(myLength).map(myMapFn) similar to

squares: Array(25).fill(null),

@oliverjam
Copy link

Have a look at this line from another team for the basic syntax of mapping over an array to render a component

@isnotafunction isnotafunction self-assigned this May 25, 2018
isnotafunction added a commit that referenced this issue May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants