How to change value on Editor (Live Markdown)

Full code: https://codepen.io/Assblack/pen/YbWyWw

I have this “handleChange” method on here:

<Editor onChange={this.handleChange} value={this.state.mark} />

So it´s supposed that when I change the value on editor, {this.state.mark} will be what I put in editor manually. And because I have the same in Previewer…:

<Previewer value={this.state.mark}/>

Hopefully the data will appear too in the Previewer.

However…there is a problem. I can´t change the data in the Editor component. Better said, I just can´t write on the textarea of Editor it doesn´t let me. I imagine it´s because I have something fixed as a value (value={this.state.mark}) but if I don´t put something like then I dont know how to handleChange can work…

Any advice will be appreciated

Editor doesn’t have a this.handleChange. It does, however, have a this.props.onChange, which you’ve passed down from App.

1 Like