FrontendDeveloper.in

React question detail

How do you access props in attribute quotes?

React (or JSX) doesn't support variable interpolation inside an attribute value. The below representation won't work:

But you can put any JS expression inside curly braces as the entire attribute value. So the below expression works:

Using template strings will also work:

Back to all React questions
Get LinkedIn Premium at Rs 399