My intention is to show the input field when the edit is pressed but with below code it doesn't work, I couldn't find out what is the problem, no error in the console.
http://jsbin.com/yezediloke/1/edit?js,console,output
class TodoItem extends React.Component {
constructor(){
super()
this.isEditing = false;
this.onClickEdit = this.onClickEdit.bind(this);
}
onClickEdit(){
this.setState({isEditing: !this.isEditing});
}
render(){
return(
<li>
<span>{this.props.item}</span>
{this.isEditing ? '<span><input type="text" /></span>' :''}
<button onClick={this.onClickEdit}>Edit</button>
<button>Save</button>
</li>
)
}
}
''from '<span><input type="text" /></span>'