index.js:1375 Warning: Each child in a list should have a unique "key" prop.
class Body extends React.Component{
constructor(props) {
super(props);
}
listItems(elems) {
console.log(elems);
return elems.map(n => <div key={n._id}>{n.name}</div>)
}
render() {
return <div>{this.props.tmp.map(n => <div key={n._id}>{n.name}</div>)}</div>;
}
}
function create(length) {
//создаем массив
var arr = [];
//выбираем 2 случайные позиции в массиве
var pos1 = randomInteger(0 , 9);
var pos2 = randomInteger(0 , 9);
//заполняем массив случайными числами из заданного диапазона
for (var i = 0; i <= length; i++) {
let number = Math.floor(Math.random() * 6 + 1);
if(number == 1){}else arr[i] = number;
}
//добавляем единицы в выбранные случайные позиции
arr[pos1] = 1;
arr[pos2] = 1;
return arr;
}
query_region.find({}, function(err,getoverhaulhouselistbyaoguids){
var i = 80;
var z = 97;
for(var l = 0; l < i; l++){
for(n = 0; n < z; n++){
if(getoverhaulhouselistbyaoguids == undefined){
console.log('asdsads');
}
const jsonAdressAndCountPeople = [];
jsonAdressAndCountPeople.push(
getoverhaulhouselistbyaoguids[l]['data'][n].address ,
getoverhaulhouselistbyaoguids[l]['data'][n].totalPpl );
var language = "ru";
var city = "Алтайский край";
var street = getoverhaulhouselistbyaoguids[l]['data'][n].address;
var clearStreet =street.replace(/([а-яa-zё-]+).*?(\s|$)/gi, (r, s) => s.length <= 4 ? '' : r);
var clearStreet = clearStreet.replace(",", "");
var clearStreet = clearStreet.replace(".", "");
var format = "jsonv2";
var cityCode = encodeURIComponent(city);
var streetCode = encodeURIComponent(clearStreet);
var get = "https://nominatim.openstreetmap.org/search?q="+streetCode+"&format=json&polygon=1&addressdetails=1";
axios.get(get)
.then(function (response) {
console.log(response);
res.setHeader('Content-Type', 'application/json');
//var data = response;
var data = res.end(response.query);
var lat = response["data"][0]['lat'];
var lon = response["data"][0]['lon'];
var display_name = response["data"][0]['display_name'];
var jsonArr = [];
jsonArr.push({
0: lat,
1: lon,
2: display_name
});
console.log(jsonArr);
return res.end('index', { data : data, q :q });
})
.catch(function (error) {
console.log('error');
console.log(error);
});
}
}
});
}