Why wont react render the actual div ( react newbie)

- 1 answer

Ad

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

May be some newbie mistake, any help appretiated

  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'))
Ad

Answer

Ad

it's ReactDOM.render

if you want to play with react on fiddle you can use official templates found here: https://facebook.github.io/react/docs/getting-started.html

edit: main problem is that your element has to start with capital letter

ReactJS component names must begin with capital letters?

Ad
source: stackoverflow.com
Ad