Why do semicolons throw error in react JSX?
问题 Below is part of my render method in JSX - why does the semicolon after the }) throw an error? It's perfectly fine in normal JavaScript <ul> { libraries.map(function (item) { return <li>{item.name.toLowerCase()}</li>; }); } </ul> 回答1: It's because JSX {} expressions are limited to a single expression. <div>{2 + 2; 3 + 3}</div> ..will throw an error. However you can solve this by having two {} expressions <div>{2 + 2}{3 + 3}</div> There's no need for semi-colons if there will only be a single