class Glass extends React.Component {
constructor(props) {
super(props);
this.state = {
names: [{n: "Gemma", num: "01"}, {n: "Katie", num: "02"}],
}
}
render() {
const { list } = this.state;
return (
<div>
<List component="hello">
{list.map(name => {
return (
<ListItem key={name.num}>
<Link to="/glassmates/" + name.num > //I keep getting error here saying unexpected token.
{name.n}
</Link>
</ListItem>
<Divider /> // also getting errror here saying adjacent jsx elements must be wrapped in an enclosing tag
)
})}
</List>
</div>
);
}
}
我列出了我在代码中遇到的一些错误,但是对于是否将列表呈现到ListItem和List组件内的Links中,我普遍感到困惑。
一只萌萌小番薯
达令说
相关分类