NameCard改成函數(shù)之后還是編譯失敗
根據(jù)老師的代碼改成了
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?'人類(lèi)':'外星人'}</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.
2019-08-28
class NameCard = (props) => {
const NameCard = (props)=>{
2019-08-20
請(qǐng)問(wèn)你導(dǎo)出了嗎 export default NameCard