-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
[DevTools] Named hooks #19097
[DevTools] Named hooks #19097
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit cc31c03:
|
Details of bundled changes.Comparing: 4c7036e...cc31c03 react-dom
react-debug-tools
react-native-renderer
react-art
react-test-renderer
react-reconciler
react-named-hooks
Size changes (experimental) |
Details of bundled changes.Comparing: 4c7036e...cc31c03 react-dom
react-debug-tools
react-art
react-test-renderer
react-native-renderer
react-reconciler
react-named-hooks
ReactDOM: size: 0.0%, gzip: -0.0% Size changes (stable) |
b97cdfd
to
6c16fa8
Compare
6c16fa8
to
cc31c03
Compare
Sorry we haven't gotten around to reviewing yet. This will be important to get back to but we haven't prioritized it yet. |
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
Bump |
Thanks for the PR! I'm not ready to dig into this yet, although I think this is probably more of the direction we'll end up heading with this feature, (once we have the bandwidth to land the change and test it and roll it out): It's more complicated but it "just works" without adding bytes to the bundle or requiring changes be made to existing apps. |
Thank you for this PR! We ended up going with another solution for this: #21641 |
#16474
This is the implementation of main proposed solution based on babel DEV-only AST transform, supporting built-in hooks.
If name is the default hook name (i.e. state for setState, reducer for useReducer), the hook is not injected by transform plugin and ignored by devtools.
Three methods of hook name extraction are used: first array item, identifier name, first argument name.
Supports:
Before
After