react.js - react this.props.children
本文介绍了react.js - react this.props.children的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
detail.jsx文件
import React from 'react'
import DetailHeader from '../components/detail-header.jsx'
import DetailContent from '../components/detail-content.jsx'
import { connect } from 'react-redux'
const detail = React.createClass({
render() {
let id = this.props.params.id
return (
<div className="container">
<DetailHeader id={id}/>
<DetailContent id={id}/>
**{this.props.children}**
</div>
)
}
})
export default detail
this.props.children
在这里指的是什么呢
解决方案
固定的一个属性,用来取标签内的子元素 <Detail>这里就是children的内容</Detail>
另外,react中组件名必须大写
react中组件名必须大写
react中组件名必须大写
重要的事说三遍
这篇关于react.js - react this.props.children的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文