React jsx attributes

React jsx attributes
0

#1

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


#2

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.