roylawxi
2019-08-13 15:45
根据老师的代码改成了
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.
class NameCard = (props) => {
const NameCard = (props)=>{
请问你导出了吗 export default NameCard
基于实例的 React16 傻瓜课程
22387 学习 · 106 问题
相似问题