Why wont react render the actual div ( react newbie)
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
Ad
source: stackoverflow.com
Related Questions
Ad
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad