(项目链接 https://github.com/wxungang/ES6_REACT_1104.git

app.jsx 文件

/**
 * Created by xiaogang on 2016/5/26.
 */
"use strict";
import ReactDOM from 'react-dom';
import test from "../components/test";
console.log(test);

ReactDOM.render(
  <div>
    <test className="myLists" title="header">
    </test>
  </div>,
  document.getElementById('body')
);

test.js文件
/**
 * Created by xiaogang on 2016/6/8.
 */
"use strict";
import {Component, PropTypes} from 'react';

export default class Test extends Component{
    constructor(props){
        super(props);
        this.state={};
    }

    render(){
        return <div>test {this.props.name }</div>
    }


}

搞定问题的大神留言我微信或者支付宝有红包哦 weixin:15800524201 

0 1

共收到1条回复

jike_7043125 658天前 #1楼

import Test from "../components/test";
console.log(test);


ReactDOM.render(
  <div>
    <test className="myLists" title="header">
    </Test>
  </div>,
  document.getElementById('body')
);

test的首字母大写,不然不报错,也渲染不出来,和ES6的语法无关

0 评论

加入小组与大家一起讨论吧