Tell us what’s happening:
My component will not render. I have React/ReactDOM linked and the appropriate HTML included. I believe I am using ReactDOM.render() correctly but nothing is happening to the preview in my code pen. I would like to get this to work before going much further into the project.
Your code so far
const markDown = `
### Headers
# Header 1
## Header 2
### Header 3
`;
class App extends React.Component {
constructor(props){
super(props);
this.state={
input: markDown,
};
};
render(){
return (
<div>
<h1>Markdown Previewer</h1>
<div className="container">
<div className= 'left'>
<textarea id='editor'></textarea>
</div>
<div className= "right">
<div id='preview' dangerouslySetInnerHTML= {{__html: marked(this.state.markdown)}}></div>
</div>
</div>
</div>
);
}
};
ReactDOM.render(<App/>, document.getElementById("root"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36
.
Challenge: Build a Markdown Previewer
Link to the challenge: