Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX shorthand property syntax #7376

Closed
vaukalak opened this issue Jul 29, 2016 · 1 comment
Closed

JSX shorthand property syntax #7376

vaukalak opened this issue Jul 29, 2016 · 1 comment

Comments

@vaukalak
Copy link

Hello,
I've searched for similar issues, but didn't found one, sorry if this is a duplicate.
Let say I have following component:

const Window = ({title, text, theme}) => (
  <View>
    <Header title={title} theme={theme}/>
    <Content text={text} theme={theme}/>
  </View>;
);

The code for forwarding properties could be less verbose with shortcut syntax:

const Window = ({title, text, theme}) => (
  <View>
    <Header {title} {theme}/>
    <Content {text} {theme}/>
  </View>;
);

I'm aware about spread operator, but it's not comfortable sometime. For example if I don't want to revalidate Header when text property is changed.

@vaukalak vaukalak changed the title JSX shortcut property syntax JSX shorhand property syntax Jul 29, 2016
@vaukalak vaukalak changed the title JSX shorhand property syntax JSX shorthand property syntax Jul 29, 2016
@zpao
Copy link
Member

zpao commented Jul 29, 2016

I appreciate the idea. However I think at this point we're going to opt for explicitness here. There's some further discussion in facebook/jsx#23 (where we maintain the JSX "spec"). Since it exists over there, I'm going to close out here.

@zpao zpao closed this as completed Jul 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants