react.dev
react.dev copied to clipboard
[Typo]: Sentence out of place?
Summary
The highlighted sentence seems out of place. It does not match the context of the page.
Page
https://react.dev/reference/rules/react-calls-components-and-hooks
Details
It's not out of place but it could be explained better. The missing context is that this pattern of passing hooks as props is commonly done as a way to do dependency injection so you can replace the hook with a mock in testing environments. Maybe we don't need to include that, but if we want to keep it we should provide more of this context.
cc @poteto
Yeah I was trying to think of examples where people might reach for dependency injection and testing seemed like the most common scenario. Adding some context about this would be great, @txbm would you be interested in opening a PR?