reactjs - React components rendering with variable names -


i have unknown list of react components render.

// react component var defaultmodule = require('./defaultmodule.js'); 

<defaultmodule/> <--- output because name class name inside defaultmodule.js

but if

// react component var sssss = require('./defaultmodule.js'); 

<sssss/> <--- not work

so there way can take list of component names , render them accordingly? thanks.

p.s: react component looks this

import react, {proptypes, component} 'react';  class testcomponent extends component {    render() {     return (       <div>      1123123123123123 hahaha small test       </div>     );   } }  export default testcomponent; 

i figured out answer discussion thread...

yes can react component must start in capital letter. sssss work sssss now.

https://github.com/facebook/react/issues/3365

the key use capitalized variable name (component) otherwise react treat built-in dom element.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -