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

React__tabs-with-router #1003

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

React__tabs-with-router #1003

wants to merge 2 commits into from

Conversation

Soi4An
Copy link

@Soi4An Soi4An commented Aug 23, 2023

Copy link

@volodymyr-soltys97 volodymyr-soltys97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job 👍
Let's improve your code

</div>

<div className="block" data-cy="TabContent">
{tabs.find(t => t.id === selectId)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're using 'tabs.find' to check if the tab exists and then 'tabs.filter' to extract the tab. This can be optimized by just using 'tabs.find' and storing the result in a variable, which improves performance by reducing the number of iterations over the 'tabs' array.

Comment on lines 21 to 22
{tabs.map(tab => (
<li

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use a destructuring for tab

Copy link

@volodymyr-soltys97 volodymyr-soltys97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done 🔥

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.

2 participants