Allow curly braces without a preceding prop= to define props. This makes it easy to refactor JSX props into objects by removing the need to change prop=value to prop: value, for each prop.
This is currently a syntax error, so allowing this shouldn't break existing code.
Example:
<Component
{
bool: true,
expr: x + y,
...spreadObject
}
/>
It also has nice symmetry with current spread syntax:
const props = {
bool: true,
expr: x + y,
...spreadObject
}
// This is already valid JSX
<Component
{
...props
}
/>
A slightly different take on this request.
Allow curly braces without a preceding
prop=
to define props. This makes it easy to refactor JSX props into objects by removing the need to changeprop=value
toprop: value,
for each prop.This is currently a syntax error, so allowing this shouldn't break existing code.
Example:
It also has nice symmetry with current spread syntax: