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://pwwzsj.com/article/gpohdj.html