A shortcut pattern to pass down props (of the same name and value) to child components. This removes the need for value repetition.
- ES6 can destruct assignments, so instead of
const location = this.props.location
, you can doconst {location} = this.props
. - ES6 can also use a shorthand syntax in object literals, so
{location: location}
can just be{location}
- JSX has its own syntax called "Spread Attributes", which allows you to provide the tag with a plain object, and each key and value will be used in the attribute, respectively. So,
<MyChild {...this.props} />
would be the equivalent to<MyChild location={this.props.location} todos={this.props.todos} user={this.props.user} />
, etc. - But if you don't want to pass all props: as per the example, you can create a new plain object, containing object-shorthand values.
Some further reading: