Commit 7af1c89
committed
fix(compiler): recognize 'use' as a hook for hook detection
React's 'use()' API is a hook for reading context and promises,
but the compiler's isHookName() function only matched 'use[A-Z0-9]'
pattern, causing custom hooks that only call use() to be silently
skipped during compilation.
This fix adds 'use' to the hook name recognition so that functions
like:
function useMyContext() {
return use(MyContext);
}
will now be correctly compiled with memoization.
Fixes #359601 parent 7b5b561 commit 7af1c89
1 file changed
Lines changed: 1 addition & 1 deletion
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
898 | | - | |
| 898 | + | |
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| |||
0 commit comments