I have a li
object and I want to create an object from its onclick
event. What I want is to be able to create an object from the event click
of list item
.
Can it be done? If you can not, is there an alternative?
Example:
class Ejemplo extends Component{
liclick(event){
<Objeto2 name="hola"/>
}
render(){
return(
<li onClick={this.liclick.bind(this)}>
)
}
}
class Objeto2 extends Component{
constructor(props) {
super(props);
}
render(){
return(
{this.props.name}
)
}
}