react通过父组件渲染子组件中的内容
- 说明:
- 代码:
// less require ('./static/less/index.less') // 核心 var React = require('react') var ReactDom = require('react-dom') var ReactRouter = require('react-router-dom') var Router = ReactRouter.BrowserRouter var Route = ReactRouter.Route var Link = ReactRouter.Link var CreateClass = require('create-react-class') var PropTypes = require('prop-types') var Ajax = require('dollarphp-ajax') // 创建组件 var Index = CreateClass({ render:function(){ return (
hello world) } }) var Head = CreateClass({ render:function(){ return ({this.props.children}) } }) // 渲染 ReactDom.render(, document.getElementById('app') ) - 效果:
分享文章:react通过父组件渲染子组件中的内容
本文来源:http://azwzsj.com/article/gpohdj.html