二、React component&&render

在app文件夹下新建一个comment文件夹,并创建CommentBox.js

CommentBox.js

'use strict';

import React from 'react';

class CommentBox extends React.Component{
    render() {
        return (
            <div className="ui comments">
                <h1>评论</h1>
                <div className="ui divider"></div>
            </div>
        );
    }
}

export { CommentBox as default }

index.html页面中

<div id="app"></div>

来到main.js

使用 import 引入 React ReactDOM CommentBox

import React from 'react';
import ReactDOM from 'react-dom';
import CommentBox from './comment/CommentBox';

浏览器最终显示效果

 

posted @ 2018-01-22 22:31  journeyIT  阅读(7)  评论(0编辑  收藏  举报