React jsx attributes

I read this attribute expression with jsx, and can’t figure when to use “” and {}?
Read:

Link: https://facebook.github.io/react/docs/jsx-in-depth.html
Attribute Expressions
To use a JavaScript expression as an attribute value, wrap the expression in a pair of curly braces ({}) instead of quotes ("").

// Input (JSX):
var person = <Person name={window.isLoggedIn ? window.name : ''} />;
// Output (JS):
var person = React.createElement(
  Person,
  {name: window.isLoggedIn ? window.name : ''}
);

How to solve this syntax error: EDIT: SOLVED

React-specific attributes are always in curly braces, which indicates a javascript expression. You might use quotes in some of the html elements inside, e.g. type="input" for a text entry, but never in a react component.

1 Like