设置和 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);
});