0

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'))
Ross
  • 1,562
  • 1
  • 15
  • 26

1 Answers1

0

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?

Community
  • 1
  • 1
juraj
  • 439
  • 2
  • 9
  • I get reactDOM is undefined, it works partially with React.render but also gives deprecation warning – Ross Dec 22 '15 at 11:10
  • ok, looks like React.render still works, your problem is the render function, e.g. this https://jsfiddle.net/1z86p1od/ works.. 1. there is no class, in react it's className 2. there should not be a div under td. Oh yeah, use capital letter for your own elements http://stackoverflow.com/questions/30373343/reactjs-component-names-must-begin-with-capital-letters – juraj Dec 22 '15 at 12:25