am doing wrong? this.props.children doesn't rendered when go url http://localhost:7000/#/about
--// file name: main.js
import react 'react'; import { router, route, link } 'react-router'; import { history } 'react-router/lib/browserhistory'; import wrapper "./components/wrapper.react"; import thumbnailcontainer './components/thumbnailcontainer.react'; react.render(( <router history={history}> <route path="/" component={wrapper}> <route path="/about" components={thumbnailcontainer}> </route> </route> </router> ), document.body); --//file name:wrapper.react.js
var wrapper = react.createclass({ getinitialstate: function() { return( { classname : "p-wrapper p-blue-theme" } ); }, render: function () { return( <div classname={this.state.classname} > {this.props.children} </div> ); } }); exports['default'] = wrapper; module.exports = exports['default']; --// file name:thumbnailcontainer.react.js
var react = require('react'); var thumbnailcontainer = react.createclass({ render: function(){ return ( <div classname="p-thumbnail-container"> <a classname="p-thumbnail" href="#"> <div classname="p-thumbnail-img-container"> <img src="http://placehold.it/200x200" classname="p-thumbnail-img" /> </div> <div classname="p-thumbnail-caption"> <h3 classname="p-title">thumbnail title</h3> <h4 classname="p-sub-title">thumbnail sub title</h4> <p classname="p-description">thumbnail description lorem ipsum</p> </div> </a> </div> ); } }); module.exports = thumbnailcontainer;
change components={thumbnailcontainer} component={thumbnailcontainer}.
Comments
Post a Comment