help in React js with ecmaScript 2015 how to call a method within the method render () {} I get an error Can not read property 'ss' of undefined (... where this error ?? I can not call the function ss that I did within the render () method: (
import React from 'react'
class Saludo extends React.Component {
constructor(){
super();
this.state={lista:[]};
}
componentWillMount() {
fetch('http://localhost/viaLacteaQuery.php')
.then((response) => {
return response.json();
})
.then((data) => {
this.setState({lista:data.data.records});
})
}
ss(){
return Math.random();
}
render() {
return (
<div>
<h1>Saluditos!!</h1>
{
this.state.lista.map(function(item) {
<ul>
return (
<ul>
<li key={this.ss()}>{item.nombre}</li>
<li key={this.ss()}>{item.cuenta}</li>
<li key={this.ss()}>{item.precio}</li>
</ul>
)
</ul>
})
}
</div>
)
}
}
export default Saludo;
without the function works well.