javascript - React.js variable -


this question has answer here:

when use variable starting small letter, page showing nothing. if change variable name start uppercase (helloworld) page showing content.

<script type="text/jsx">  var helloworld = react.createclass({     render : function () {                 return (                     <div>                     <h1>hello world</h1>                     </div>                     );     }  });   react.render(<helloworld/> , document.body); </script> 

can tell me why happening?

as of react v0.12., upper-case components react convention distinguishing between components , html tags.

from react documentation under html tags vs. react components header:

to render react component, create local variable starts upper-case letter:

var mycomponent = react.createclass({/*...*/}); var myelement = <mycomponent someproperty={true} />; react.render(myelement, document.getelementbyid('example')); 

react's jsx uses upper vs. lower case convention distinguish between local component classes , html tags.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -