I want to access the value of a textfield that's being created by React. The code is below:
class Paragraph extends React.Component {
render() {
let style = {
height: "150px",
marginBottom: "10px"
};
return (
<div className="paragraph" id={this.props.id}>
<div className="row">
<div className="col-sm-11">
<textarea
className="form-control"
name={"paragraph" + this.props.id}
placeholder="Put Paragraph Here"
style={style}
required
></textarea>
</div>
<div className="col-sm-1">
<div
className="btn btn-danger del-rotate"
onClick={() => this.props.remove(this.props.id)}
>
×
</div>
</div>
</div>
</div>
);
}
}
I'm using an index.js, which contains an App and adds a Paragraph. I want to access the value typed in the textarea from my index.js, which uses Paragraph. How do I do this?