Why wont react render the actual div ( react newbie)

时间:2015-12-22 10:21:56

标签: javascript reactjs

I am trying react for the first time. All I am trying to do is render a div inside another via react. refer the fiddle Fiddle link

可能是一些新手的错误,任何有用的帮助

  HTML 

<div id='reactDom' style="border: 1px solid red; padding: 20px;"></div>

JS

var dateImage = React.createClass({
    render : function(){
        return (<td>
                <div class="event_mdl-slider">
                    <div class="event_slider relative" id="event_slider_id">
                        <div class="item"><i style="font-size:40px;" id="slider_1" class="fa fa-file-image-o"></i></div>
                        <div class="item"><i style="font-size:40px;" id="slider_2" class="fa fa-file-text-o"></i></div>
                    </div>
                </div>
            </td>);
    }
})

React.render(<dateImage onload={alert(1)}/>, document.getElementById('reactDom'))

1 个答案:

答案 0 :(得分:0)

是ReactDOM.render

如果您想玩小提琴上的反应,可以使用此处的官方模板:https://facebook.github.io/react/docs/getting-started.html

编辑: 主要问题是你的元素必须以大写字母

开头

ReactJS component names must begin with capital letters?