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

Categories on the DOM #13

Open
wants to merge 6 commits into
base: complete
Choose a base branch
from
Open

Categories on the DOM #13

wants to merge 6 commits into from

Conversation

drteresavasquez
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Oct 13, 2021

✔️ 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) => (
Copy link

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) => (

Copy link

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

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

Successfully merging this pull request may close these issues.

None yet

2 participants