the following ended up not working. nothing was rendered to the dom. i don’t know what was my mistake.
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
const markdownvar = `# Welcome to my React Markdown Previewer!
## This is a sub-heading...
### And here's some other cool stuff:
Heres some code, \`<div></div>\`, between 2 backticks.
\`\`\`
// this is multi-line code:
function anotherExample(firstLine, lastLine) {
if (firstLine == '\`\`\`' && lastLine == '\`\`\`') {
return multiLineCode;
}
}
\`\`\`
You can also make text **bold**... whoa!
Or _italic_.
Or... wait for it... **_both!_**
And feel free to go crazy ~~crossing stuff out~~.
There's also [links](https://www.freecodecamp.com), and
> Block Quotes!
And if you want to get really crazy, even tables:
Wild Header | Crazy Header | Another Header?
------------ | ------------- | -------------
Your content can | be here, and it | can be here....
And here. | Okay. | I think we get it.
- And of course there are lists.
- Some are bulleted.
- With different indentation levels.
- That look like this.
1. And there are numbererd lists too.
1. Use just 1s if you want!
1. But the list goes on...
- Even if you use dashes or asterisks.
* And last but not least, let's not forget embedded images:

`
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
markdown: markdownvar
}
this.handleChange = this.handleChange.bind(this)
}
handleChange(event) {
this.setState({
markdown: event.target.value
});
}
render() {
const markerlib = marked(input, {breaks: true});
return (
<div className="container-fluid">
<h1 className="text-primary text-center">Markdown Previewer</h1>
<div className="row">
<div className="col-xs-6">
<h4>#editor</h4>
<div className="well" id="left-well">
<div id="hello">
<textarea id="editor" value={this.state.markdown} onChange={this.handleChange}/>
</div>
</div>
</div>
<div className="col-xs-6">
<h4>#preview</h4>
<div className="well" id="right-well">
<div id="preview" dangerouslySetInnerHTML={{__html: markerlib}} />
</div>
</div>
</div>
</div>
);
};
};
ReactDOM.render(<App />, document.getElementById("app"));
i found this method and i copy-pasted it to be honest:
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
const markdownvar = `# Welcome to my React Markdown Previewer!
## This is a sub-heading...
### And here's some other cool stuff:
Heres some code, \`<div></div>\`, between 2 backticks.
\`\`\`
// this is multi-line code:
function anotherExample(firstLine, lastLine) {
if (firstLine == '\`\`\`' && lastLine == '\`\`\`') {
return multiLineCode;
}
}
\`\`\`
You can also make text **bold**... whoa!
Or _italic_.
Or... wait for it... **_both!_**
And feel free to go crazy ~~crossing stuff out~~.
There's also [links](https://www.freecodecamp.com), and
> Block Quotes!
And if you want to get really crazy, even tables:
Wild Header | Crazy Header | Another Header?
------------ | ------------- | -------------
Your content can | be here, and it | can be here....
And here. | Okay. | I think we get it.
- And of course there are lists.
- Some are bulleted.
- With different indentation levels.
- That look like this.
1. And there are numbererd lists too.
1. Use just 1s if you want!
1. But the list goes on...
- Even if you use dashes or asterisks.
* And last but not least, let's not forget embedded images:

`
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
markdown: markdownvar
}
this.handleChange = this.handleChange.bind(this)
}
handleChange(event) {
this.setState({
markdown: event.target.value
});
}
render() {
return (
<div className="container-fluid">
<h1 className="text-primary text-center">Markdown Previewer</h1>
<div className="row">
<div className="col-xs-6">
<h4>#editor</h4>
<div className="well" id="left-well">
<div id="hello">
<textarea id="editor" value={this.state.markdown} onChange={this.handleChange}/>
</div>
</div>
</div>
<div className="col-xs-6">
<h4>#preview</h4>
<div className="well" id="right-well">
<div id="preview" dangerouslySetInnerHTML={{__html: marked(this.state.markdown)}} />
</div>
</div>
</div>
</div>
);
};
};
ReactDOM.render(<App />, document.getElementById("app"));