Submitted almost 3 years ago
React.js responsive site. Using Class based components and context
@aropsta
Design comparison
SolutionDesign
Solution retrospective
Any suggestions or questions are welcome! :smile:
Community feedback
- @ccreusatPosted almost 3 years ago
Nice challenge ! Interesting to see the use of React context with Class components.
I would suggest to use
.map()
method to render your<Card>
component instead of selecting all your item like this :let work = inputData[0]; let play = inputData[1]; let study = inputData[2]; let exercise = inputData[3]; let social = inputData[4]; let selfCare = inputData[5];
You could do
{ inputData.map((item, index) => <Card key={index} data={item}></Card>}
index
could be replace with ID (and it's a better practice) example :key={item.id}
Hope this helps :)
Marked as helpful1@aropstaPosted almost 3 years ago@ccreusat Thanks for that! This part had always bothered, I knew there was a better way
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord