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

[Mistake]: getVisibleTodos() does not re-run (and does not print any logs) when you type into the input to begin with! #6682

Closed
Krishnagopal-Sinha opened this issue Mar 7, 2024 · 2 comments

Comments

@Krishnagopal-Sinha
Copy link

Krishnagopal-Sinha commented Mar 7, 2024

Summary

The second objective (highlighted below) of the challenge is the default behavior of the starting base code.
image

Page

https://react.dev/learn/you-might-not-need-an-effect#challenges

Details

Challenge Objective:
"Your task is to remove the Effect that recomputes the visibleTodos list in the TodoList component. However, you need to make sure that getVisibleTodos() does not re-run (and so does not print any logs) when you type into the input."

While the first half I did with useMemo, (Valid Challenge)
The second half, where we're supposed to make sure that "getVisibleTodos() does not re-run (and so does not print any logs) when we type into the input" but it is the default behavior of the code, even without any changes to the base starter code, this is how it behaves to begin with. So I feel it's a mistake and should be improved...

@Krishnagopal-Sinha Krishnagopal-Sinha changed the title [Mistake]: getVisibleTodos() does not re-run (and so does not print any logs) when you type into the input to begin with! [Mistake]: getVisibleTodos() does not re-run (and does not print any logs) when you type into the input to begin with! Mar 7, 2024
@pwbriggs
Copy link

pwbriggs commented Mar 7, 2024

@TheMaskedGuy the challenge is to remove the useEffect while still not calling getVisibleTodos() every time the input changes:

Your task is to remove the Effect that recomputes the visibleTodos list in the TodoList component. However, you need to make sure that getVisibleTodos() does not re-run (and so does not print any logs) when you type into the input.

Hope this helps! ❤️

@Krishnagopal-Sinha
Copy link
Author

My bad, thanks for clearing that out. I seemed to have skimmed over the " while still not calling " part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants