[英]React: Can I match the div id with Props
I want to say, 我想说,
componentDidMount() {
if (x == y) {
var x = ReactDOM.findDOMNode(this)
var y = div.id
$('#y').append(x)
}
}
If the div id is equal to the name of the node, then append the node onto that div. 如果div ID等于节点的名称,则将节点附加到该div上。
I am making a calendar application that and each event is a separate component that must be mapped onto a div with an id of 9:00AM, 10:00AM, 11:00AM, 12:00PM etc. 我正在制作一个日历应用程序,每个事件都是一个单独的组件,必须将其映射到ID为9:00 AM、10:00AM、11:00AM、12:00PM等的div上。
This.props.start_time returns this.props.start_time返回
12:00AM
This is what worked: 这是有效的:
componentDidMount() {
var x= ReactDOM.findDOMNode(this)
var y = this.props.time
$('#' + y).append(x)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.