我想在使用semantic-ui時使模板的組件分解並獲得編譯錯誤。 (意外的令牌(11:12))創建React組件,返回部分語義UI網格行
您可能需要一個合適的加載程序來處理此文件類型。
import React, { Component } from 'react';
import { Container, Label, Grid } from 'semantic-ui-react'
export default class StatusLine extends Component {
constructor(props) {
this.state = props.fyrevm;
}
render() {
return (
<Grid.Row>
<Grid.Column width={8}>
<Container textAlign='right'>
<Label sub>Score</Label><span>{this.state.score}</span>
<Label sub>Turn</Label><span>{this.state.turn}</span>
<Label sub>Time</Label><span>{this.state.time}</span>
</Container>
</Grid.Column>
</Grid.Row>
);
}
}
我會對主要問題發表評論。無狀態你的意思是不使用this.state,只使用道具參數? (仍然不會用super();)編譯。 –