mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-25 23:05:23 +00:00
Update separating-events-from-effects.md
This commit is contained in:
@@ -661,8 +661,8 @@ function Page({ url }) {
|
||||
const { items } = useContext(ShoppingCartContext);
|
||||
const numberOfItems = items.length;
|
||||
|
||||
const onVisit = useEvent((visitedUrl) => {
|
||||
logVisit(url, numberOfItems);
|
||||
const onVisit = useEvent(visitedUrl => {
|
||||
logVisit(visitedUrl, numberOfItems);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -757,4 +757,4 @@ It's possible that in the future, some of these restrictions will be lifted. But
|
||||
- Only call Event functions from inside Effects
|
||||
- Don't pass Event functions to other components or Hooks
|
||||
|
||||
</Recap>
|
||||
</Recap>
|
||||
|
||||
Reference in New Issue
Block a user