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

[Feature request] Leverage useDebugValue in useSelector #1525

Closed
Finesse opened this issue Feb 21, 2020 · 4 comments · Fixed by #1530
Closed

[Feature request] Leverage useDebugValue in useSelector #1525

Finesse opened this issue Feb 21, 2020 · 4 comments · Fixed by #1530

Comments

@Finesse
Copy link
Contributor

Finesse commented Feb 21, 2020

Debugging components with the useSelector hook is more complicated that it could be. In order to see a useSelector return value, I have to put console.log in my code or dive deep into the hook to find the internal useState that stores the current selector value. React has a browser extension that shows inner state of React tree, components and hooks, and provides a way to attach a value to a hook in the extension UI:

image

The useSelector hook may call useDebugValue to show the current selected value next to the hook in the hooks list of the extension UI (like the built-in hooks do). It would be very handy.

I don't know whether using the hook impacts the performance. Using the hook only during development would be sufficient.

@timdorr
Copy link
Member

timdorr commented Feb 21, 2020

This seems like a good idea to me. Can you work up a PR?

@Finesse
Copy link
Contributor Author

Finesse commented Feb 22, 2020

@timdorr Yes, I’ll make a PR in a couple days

@danny-does-stuff
Copy link

When will this feature be released?

@markerikson
Copy link
Contributor

Finally live in https://github.com/reduxjs/react-redux/releases/tag/v7.2.1

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 a pull request may close this issue.

4 participants