when i type in the editor it shows up in the preview but does not convert to markdown language. Does anyone know why?
const defaultEdit = "#heading";
class Presentational extends React.Component{
constructor(props){
super(props);
this.state ={
input: defaultEdit
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(e){
this.setState({
input:e.target.value
})
}
render(){
const markdown = marked(this.state.input);
const innerHTML = {__html: markdown};
return (
<div class="row">
<div class="col-md-6">
<textarea id="editor" onChange={this.handleChange} class= "form-control">{this.state.input}</textarea>
</div>
<div class="col-md-6">
<div id="preview" dangerouslySetInnerHTML ={innerHTML}></div>
</div>
</div>
)
};
};
ReactDOM.render(<Presentational />, document.getElementById("app"));
see on codepen: https://codepen.io/Logan_code/pen/WNoOrYP