The ${}
is template literals. What's {}
without the $
sign?
In React:
function App(){
return(<div temp={3}></div>);
}
(I was looking up the difference and nothing came up. So, I think this question is needed as I couldn't know if I was using JS or JSX.)
You're quite correct that javascript uses ${}
to make use of template literals within strings surrounded by backticks `
The code you pasted is not javascript, it is JSX and the {
and }
is how you embed expressions within it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.