Andrew Clark 7 years ago
parent
commit
028b52d9bd
  1. 12
      content/blog/2017-11-28-react-v16.2.0-fragment-support.md

12
content/blog/2017-11-28-react-v16.2.0-fragment-support.md

@ -19,7 +19,7 @@ render() {
}
```
This exciting new feature is made possible by new additions to both React and JSX.
This exciting new feature is made possible by additions to both React and JSX.
## What Are Fragments?
@ -133,7 +133,7 @@ Fragment syntax in JSX was inspired by prior art such as the `XMLList() <></>` c
Note that the `<></>` syntax does not accept attributes, including keys.
If you need a keyed fragment, you can use `<React.Fragment />` directly. An use case for this is mapping a collection to an array of fragments -- for example, to create a description list:
If you need a keyed fragment, you can use `<Fragment />` directly. An use case for this is mapping a collection to an array of fragments -- for example, to create a description list:
```jsx
function Glossary(props) {
@ -159,7 +159,7 @@ You can experiment with JSX fragment syntax with this [CodePen](https://codepen.
## Support for Fragment Syntax
These additions Support for fragment syntax in JSX will vary depending on the tools you use to build your app. Please be patient as the JSX community works to adopt the new syntax. We've been working closely with maintainers of the most popular projects:
Support for fragment syntax in JSX will vary depending on the tools you use to build your app. Please be patient as the JSX community works to adopt the new syntax. We've been working closely with maintainers of the most popular projects:
### Create React App
@ -269,18 +269,18 @@ For other tools, please check with the corresponding documentation to check if t
## Installation
React v16.0.0 is available on the npm registry.
React v16.2.0 is available on the npm registry.
To install React 16 with Yarn, run:
```bash
yarn add react@^16.0.0 react-dom@^16.0.0
yarn add react@^16.2.0 react-dom@^16.2.0
```
To install React 16 with npm, run:
```bash
npm install --save react@^16.0.0 react-dom@^16.0.0
npm install --save react@^16.2.0 react-dom@^16.2.0
```
We also provide UMD builds of React via a CDN:

Loading…
Cancel
Save