1
所以我有這個組件反應道具的渲染工作不
import React from 'react';
import ReactDOM from 'react-dom';
import NeoHeader from './header/NeoHeader';
import NeoLoginModal from './modal/NeoLoginModal';
class Neo extends React.Component {
constructor(props) {
super(props);
this.state = {loginModal: false};
}
render() {
return(<NeoHeader/> { this.state.loginModal ? <NeoLoginModal /> : null })
}
}
ReactDOM.render(
<Neo/>,
document.getElementById('react-wrapper')
);
,正如你所看到的,我試圖展示組件NeoLoginModal時的狀態道具設置爲true。但是,使用Laravel混合構建在{this..}
開始時會產生意外的令牌錯誤。這是記錄在多個地方作爲一個正確的方式來做到這一點,所以錯誤是什麼?