I have this code here and when it renders it doesn't show the this.props.child within the textarea but it shows on top of the textarea,
renderNormal(){
return (<div className="commentContainer">
<div className="commentText">{this.props.child}</div>
<button onClick={()=>{this.edit()}} className="button-primary">EDIT </button>
<button onClick={()=>{this.delete()}} className="button-danger">DELETE </button>
</div>);
}
renderForm(){
return (<div className="commentContainer">
<textarea defaultValue= {this.props.child}> </textarea>
<button onClick={()=>{this.save()}} className="button-primary">SAVE </button>
</div>);
}
render(){
if(this.state.editing){
return this.renderForm();
}else {
return this.renderNormal();
}
}
I'm passing in the child value like this,
ReactDOM.render(<div className="board"> CHILD1<Movie/> CHILD2<Movie/> </div>, document.getElementById('root'));
I'm not sure if the above is the right way to do this but when i try to do it this way
ReactDOM.render(<div className="board"> <Movie>CHILD1</Movie> <Movie>CHILD2</Movie> </div>, document.getElementById('root'));
I get an error.
I'm very new to react, please be patient I'll try my best to understand. THanks for helping.