JSX - Syntax

0 votes
350 views
added Mar 8, 2019 in JSX by LC Marshal Captain (25,790 points)
edited Mar 8, 2019 by LC Marshal
// using return

// parentheses need to be use for return that has more than 1 line, to not break the code

// e.g
return <layout/>

return (
  <layout value={this.setState[i]}
  onClick={) => thishandleClicki)}
  />
)

 

1 Response

0 votes
responded Mar 8, 2019 by LC Marshal Captain (25,790 points)

in HTML, you pass a string as the event handler

<button onclick="activateLink()">
  Activate Link
</button>

 

in React, you pass function instead 

<button onClick={activateLink}>
  Activate Link
</button>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...