镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Curly braces for attribute expressions are pointless and ugly #103

Description

Originally submitted to facebook/react here: react/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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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