NameCard改成函数之后还是编译失败
根据老师的代码改成了
class NameCard = (props) => {
const {name,number,isHuman,tags}=props
return(
<div className="alert alert-success">
<h4 className="alert-heading">{name}</h4>
<ul>
<li>电弧:{number}</li>
<li>{isHuman?'人类':'外星人'}</li>
</ul>
<p>
{tags.map((tag, index)=>(<span key={index}>
{tag}
</span>))}
</p>
</div>
)
}
但是保存之后还是编译失败
Failed to compile
./src/components/NameCard.js
Line 3: Parsing error: Unexpected token, expected "{"
1 | import React from 'react'
2 |
> 3 | class NameCard = (props) => {
| ^
4 | const {name,number,isHuman,tags}=props
5 | return(
6 | <div className="alert alert-success">
This error occurred during the build time and cannot be dismissed.