2015-12-26 47 views
0

我開始使用流星並做出反應。這是我做了什麼:JSX不被流星識別

meteor create simple-react 
meteor add kadira:flow-router 
meteor add kadira:react-layout 

mkdir client server lib 
mkdir client/components 
touch client/head.html 
touch lib/routes.jsx 

在routes.jsx,我已經添加了主頁路線:

FlowRouter.route("/", { 
name: "Home", 
action(params) { 
    ReactLayout.render(Home); 
} 
}); 

在home.jsx,我創建了一個簡單的家庭成分。

在瀏覽器控制檯中,出現錯誤:無法找到「/」。

如果我將routes.jsx轉換爲route.js,那麼這些路由就可以工作。但是,我收到錯誤:無法在瀏覽器日誌中找到Home組件。

由於某些原因,JSX沒有被Meteor識別,也沒有被編譯成JS。

我有所有必需的軟件包 - ecmascript,jsx,react,react-runtime。

+0

您需要創建一個'Home'組件'Home = React.createClass({})' –

+0

我已經有了一個Home組件。修復了錯誤。不知道爲什麼。我必須明確地做一個「流星加反應」。 – vijayst

回答

0

雖然我加了kadira:react-layout,但我必須明確地向包列表添加反應。將反應添加到軟件包列表中修復了它。