1. There is a problem. I don"t know what"s wrong.
Uncaught SyntaxError: Inline Babel script: Unexpected token, expected , (68:33)
66 | <td colSpan="2"><ProductCategoryRow category={item[0].category} /></td>
67 | </tr>
> 68 | {item.map((line) => {
| ^
69 | return (<ProductRow name={line.name} price={line.price} key={line.name}/>)}
70 | )}
71 |
at Parser.pp$5.raise (babel.js:17994)
at Parser.pp.unexpected (babel.js:15337)
at Parser.pp.expect (babel.js:15325)
at Parser.pp$3.parseParenAndDistinguishExpression (babel.js:17368)
at Parser.pp$3.parseExprAtom (babel.js:17263)
at Parser.parseExprAtom (babel.js:20637)
at Parser.pp$3.parseExprSubscripts (babel.js:17048)
at Parser.pp$3.parseMaybeUnary (babel.js:17028)
at Parser.pp$3.parseExprOps (babel.js:16958)
at Parser.pp$3.parseMaybeConditional (babel.js:16935)
2. Partial code with error:
class ProductTable extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<table>
<thead>
<tr>
<th><span className="title">Name</span></th>
<th><span className="title">Price</span></th>
</tr>
</thead>
<tbody>
{this.props.categoryArray.map((item,index) => {
return (
<tr key={index}>
<td colSpan="2"><ProductCategoryRow category={item[0].category} /></td>
</tr>
{item.map((line) => {
return (<ProductRow name={line.name} price={line.price} key={line.name}/>)}
)}
)})}
</tbody>
</table>
)
}
}
3. Document link https://doc.react-china.org/d.