In JSX, how do you reference a value from props
from inside a quoted attribute value?
For example:
The resulting HTML output is:
Answer
React (or JSX) doesn't support variable interpolation inside an attribute value, but you can put any JS expression inside curly braces as the entire attribute value, so this works:
No comments:
Post a Comment