設定和 Hello World
將 React 新增到你的專案:
meteor npm install --save react react-dom react-mounter
建立 client/helloworld.jsx
檔案以顯示簡單的 React 元件:
import React, { Component } from 'react';
import { mount } from 'react-mounter';
// This component only renders a paragraph containing "Hello World!"
class HelloWorld extends Component {
render() {
return <p>Hello World!</p>;
}
}
// When the client application starts, display the component by mounting it to the DOM.
Meteor.startup(() => {
mount(HelloWorld);
});