Browse Source

use "allowlist" in DOM Attributes in React 16 page (#3532)

main
Hamir Mahal 4 years ago
committed by GitHub
parent
commit
adfa67ad01
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      content/blog/2017-09-08-dom-attributes-in-react-16.md

6
content/blog/2017-09-08-dom-attributes-in-react-16.md

@ -32,7 +32,7 @@ React has always provided a JavaScript-centric API to the DOM. Since React compo
<div tabIndex={-1} />
```
This has not changed. However, the way we enforced it in the past forced us to maintain a whitelist of all valid React DOM attributes in the bundle:
This has not changed. However, the way we enforced it in the past forced us to maintain a allowlist of all valid React DOM attributes in the bundle:
```js
// ...
@ -47,9 +47,9 @@ This had two downsides:
* You could not [pass a custom attribute](https://github.com/facebook/react/issues/140). This is useful for supplying browser-specific non-standard attributes, trying new DOM APIs, and integrating with opinionated third-party libraries.
* The attribute list kept growing over time, but most React canonical attribute names are already valid in the DOM. Removing most of the whitelist helped us reduce the bundle size a little bit.
* The attribute list kept growing over time, but most React canonical attribute names are already valid in the DOM. Removing most of the allowlist helped us reduce the bundle size a little bit.
With the new approach, both of these problems are solved. With React 16, you can now pass custom attributes to all HTML and SVG elements, and React doesn't have to include the whole attribute whitelist in the production version.
With the new approach, both of these problems are solved. With React 16, you can now pass custom attributes to all HTML and SVG elements, and React doesn't have to include the whole attribute allowlist in the production version.
**Note that you should still use the canonical React naming for known attributes:**

Loading…
Cancel
Save