我剛剛開始與reactjs並試圖讓我的jsx去熱重新加載。我分叉了這個程序:https://github.com/gaearon/react-hot-boilerplate/tree/next。如何使反應熱裝載機爲jsx工作?
我改變了app.js稍微:
import React, { Component } from 'react';
export default class App extends Component {
constructor(){
super();
this.state = {
txt: 'this is the txt',
cat: 0
}
}
render() {
return (<div>
{this.state.txt}
<h1>sdfdsfdsfs, world.</h1>
</div>
);
}
}
當我改變了H1標籤中的文字是刷新瀏覽器。但是,當我更改txt屬性沒有任何反應。我怎樣才能得到這個工作?
你的意思是,當你改變'this.state = txt的狀態{...}'在構造函數中沒有任何反應? – garrettmaring