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
Categories on the DOM #13
base: complete
Are you sure you want to change the base?
Conversation
✔️ Deploy Preview for you-do ready! 🔨 Explore the source changes: d578cf6 🔍 Inspect the deploy log: https://app.netlify.com/sites/you-do/deploys/61671c248af03b0008d313b0 😎 Browse the preview: https://deploy-preview-13--you-do.netlify.app |
|
||
return ( | ||
<div> | ||
{Object.keys(categorizedTodos).map((category) => ( |
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.
The More You Know
You could also use Object.entries()
It gives you access to the key and value in an array so you'd have to destructure like this.
Object.keys(categorizedTodos).map(([key, value]) => (
So on line 43 you don't have to grab the value using bracket notation. You'd instead do this
{value.map((todo) => (
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.
I just looked it up, and the way you did it was more performant 🙃
https://gists.cwidanage.com/2018/06/how-to-iterate-over-object-entries-in.html
No description provided.