我是一个新的反应,我只是做了一个视图计数器的各种divs.For,我需要的高度的div和scrollTop的height.But后,我必须设置的值,它不工作的values.But。
var React = require('react');
var ReactDOM = require('react-dom');
var NewsDetail = require('./news-details');
var $ = require('jquery');
module.exports = React.createClass({
getInitialState: function() {
return {
news: [{
id: "5",
data: "I probably am using the wrong I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value terminology here but this is what I'm trying to do. I want to create a map with a value for each key and a value for each key's object. S"
}, {
id: "6",
data: "I probably am using the wrong I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value terminology here but this is what I'm trying to do. I want to create a map with a value for each key and a value for each key's object. S"
}, {
id: "7",
data: "I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value for each key and a value for each key's object. S"
}, {
id: "8",
data: "I probably am using the wrong I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value terminology here but this is what I'm trying to do. I want to create a map with a value for each key and a value for each key's object. S"
}, {
id: "9",
data: "I probably am using the wrong I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value I probably am using the wrong terminology here but this is what I'm trying to do. I want to create a map with a value terminology here but this is what I'm trying to do. I want to create a map with a value for each key and a value for each key's object. S"
}, ],
length: null,
height: 0
}
},
componentWillMount: function() {},
componentDidMount: function() {
console.log(this.state.length)
var lengthh = document.getElementById('newscontanier').children.length;
console.log(lengthh);
if(lengthh != this.state.length) {
this.setState({
length: lengthh //Still null
})
}
},
render: function() {
var newsdata = this.state.news.map(function(newss) {
return( < NewsDetail key = {
newss.id
} {...newss
}
/>)
});
return(<div className="newscontanier" id="newscontanier">{newsdata}</div>)
}
})发布于 2016-08-31 01:48:35
这里只有一个语法错误,删除jsx -
return (
<div className="newscontanier" id="newscontanier">{newsdata}</div>
);请参阅此处的工作副本- https://jsfiddle.net/69z2wepo/54531/
https://stackoverflow.com/questions/39233662
复制相似问题