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

add task solution #1036

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

add task solution #1036

wants to merge 5 commits into from

Conversation

mykhailonl
Copy link

Copy link

@TarasHoliuk TarasHoliuk 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! A few small comments

});
};

const [visibleTodos, setVisibleTodos] = useState(todos);

Choose a reason for hiding this comment

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

So todos, query, and status are stored in state (redux state in this case). Taking it into account - the re-render will happen on any of these variables change. It means there is no reason to store visible todos in state - store them in common variable (and useMemo)

</div>
</div>
) : null}

Choose a reason for hiding this comment

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

use && instead of ternary in this case

@TarasHoliuk
Copy link

It shouldn't be visible:

image

Check working version

@mykhailonl
Copy link
Author

It shouldn't be visible:

image

Check working version

cant open an image

Copy link

@anastasiiavorobiova anastasiiavorobiova left a comment

Choose a reason for hiding this comment

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

Great work! Almost done!

</thead>

<tbody>
{visibleTodos.map(todo => (

Choose a reason for hiding this comment

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

Consider using keys while rendering list

data-cy="clearSearchButton"
type="button"
className="delete"
onClick={() => dispatch(setQuery(''))}

Choose a reason for hiding this comment

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

Suggested change
onClick={() => dispatch(setQuery(''))}
onClick={resetQuery}

Copy link

@anastasiiavorobiova anastasiiavorobiova left a comment

Choose a reason for hiding this comment

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

Great work!

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.

3 participants