JSX - Specifying Attributes

0 votes
171 views
added May 14, 2019 in JSX by LC Marshal Captain (25,790 points)
// use quotes to specify string literals as attributes:
const thing = <div tabIndex="0"></div>;

// or use curly braces to embed JS expression in attribute:
const thing = <img src={user.profilePic}></img>;

 

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