Browse Source

Tweak event delegation notes

main
Dan Abramov 4 years ago
committed by GitHub
parent
commit
6682068641
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      content/docs/testing-recipes.md

3
content/docs/testing-recipes.md

@ -377,7 +377,6 @@ let container = null;
beforeEach(() => {
// setup a DOM element as a render target
container = document.createElement("div");
// container *must* be attached to document so events work correctly.
document.body.appendChild(container);
});
@ -416,7 +415,7 @@ it("changes value when clicked", () => {
});
```
Different DOM events and their properties are described in [MDN](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent). Note that you need to pass `{ bubbles: true }` in each event you create for it to reach the React listener because React automatically delegates events to the document.
Different DOM events and their properties are described in [MDN](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent). Note that you need to pass `{ bubbles: true }` in each event you create for it to reach the React listener because React automatically delegates events to the root.
> Note:
>

Loading…
Cancel
Save