Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

JSX - Syntax

0 votes
17 views
added Mar 8 in JSX by LC Marshal Captain (20,510 points)
edited Mar 8 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 by LC Marshal Captain (20,510 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.
...