0

Trying to make a Markdown Previewer for a freeCodeCamp project. My editor was working fine, but now I can't update the markdown in my state; it's stuck on the placeholder text I wrote. Whenever I try to type in the editor textarea, it sends my cursor to the bottom of the text box. Editor is supposed to just accept an event using a handleChange method, and I cannot figure out why it's not working for the life of me. Worked fine until I downloaded Marked. Here's a link to the CodePen where I'm fiddling with it. The onChange function is pretty standard.handleChange(event) {this.setState({markdown: event.target.value})};

1 Answer 1

0

Update: found out the problem. Figured out I needed to set the markdown as the defaultValue prop, not the value prop.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.