Skip to content

Commit

Permalink
use "allowlist" in DOM Attributes in React 16 page (reactjs#3532)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamirmahal authored Feb 17, 2021
1 parent 47e444a commit adfa67a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/blog/2017-09-08-dom-attributes-in-react-16.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ...
Expand All @@ -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:**

Expand Down

0 comments on commit adfa67a

Please sign in to comment.