Skip to content

Curly braces for attribute expressions are pointless and ugly #103

Open
@ghost

Description

Originally submitted to facebook/react here: facebook/react#11944
Relates to: #65

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
Curly braces are required to delimit Javascript expressions in JSX attributes.

<MyComponent foo={bar(1, 2, 3)} />

What is the desired behavior?
All Javascript expressions can be expressed without the need for {}.

<MyComponent foo=bar(1, 2, 3) baz="quirk" life=42 pi=3.1415 sum=(x + y) fancy=`Hello ${name}` onClick=()=>{ this.andThat() } />

In short, requiring {} around all of these is unnecessary although the last one is a bit ugly with the =()=> thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions