我成功地遵循這個指南學習使用鐵流星 https://medium.com/meteor-js/how-to-build-web-apps-ultra-fast-with-meteor-iron-scaffolding-and-automatic-form-generation-11734eda8e67#.gw50bxjif鐵流星不識別反應?
於是我去了命令行,做了iron add react
。
我創建了一個簡單的反應組分app/client/templates/App.jsx
與內容
App = React.createClass({
render() {
return (
<div className="container">
Hello World
</div>
);
}
});
然後,當在app/lib/controllers/issues_list_controller.js
我替換爲代碼的動作的功能。
action: function() {
// this.render();
var router = this;
Meteor.startup(function() {
ReactDOM.render(<App router={router} />, document.getElementById("render-target"));
});
},
現在,當我運行命令行命令iron
啓動項目,我得到的錯誤
W20151230-00:48:14.955(-5)? (STDERR) ReactDOM.render(<App router={router} />, document.getElementById("render
W20151230-00:48:14.957(-5)? (STDERR) ^
W20151230-00:48:14.980(-5)? (STDERR) SyntaxError: Unexpected token <
就好像流星鐵不承認反應,JSX標誌嗎?我如何得到這個工作?
據我所知,鐵路由器不能很好地處理反應http://stackoverflow.com/questions/32792092/configure -iron-router-in-meteor-react我正在轉移到'FlowRouter'的路上 –
謝謝@ThaiTran,但我做了一個簡單的meteorjs +鐵路由器+反應應用程序,結果很好。關於鐵流星的事情似乎沒有認識到反應的標記,儘管... – John