# Markdown Previewer - Frontend Libraries Project! Feedback needed!

**URL:** <https://forum.freecodecamp.org/t/markdown-previewer-frontend-libraries-project-feedback-needed/424546>\
**Category:** I Built This\
**Created:** [October 7, 2020, 5:07pm UTC](https://forum.freecodecamp.org/t/markdown-previewer-frontend-libraries-project-feedback-needed/424546 "2020-10-07T17:07:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariajoseamir](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mariajoseamir/32/183235_2.png) [@mariajoseamir](https://forum.freecodecamp.org/u/mariajoseamir)\
**Post date:** [October 7, 2020, 5:07pm UTC](https://forum.freecodecamp.org/t/markdown-previewer-frontend-libraries-project-feedback-needed/424546/1 "2020-10-07T17:07:58Z")

</div>

Hi! I’ve finished the project for markdown previewer! from the frontend Libraries Project! I’ll appreciate anyone who wants to check my code and see what can i do better, and what things i need to change! Thank you very much! Here is my code!

> **[Markdown Previewer Project Maria A.](https://codepen.io/mariajoseamir/pen/RwRwVWa)**
>
> ...

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [October 7, 2020, 7:11pm UTC](https://forum.freecodecamp.org/t/markdown-previewer-frontend-libraries-project-feedback-needed/424546/2 "2020-10-07T19:11:00Z")

</div>

It looks pretty good.

If I put on my nitpick hat, if I were reviewing this as a PR at work…

The method _parseMarkdown_ seems unnecessary, I would have just done:

```auto
<div className="preview" dangerouslySetInnerHTML={ {__html: marked(this.props.markdown)} } id="preview" />

```

And MarkdownPreviewer could be a functional component:

```auto
const MarkdownPreviewer = () = {
  return(
    <div>
      <Editor />
    </div>
  )
}

```

For that matter, why are we wrapping it in a `div`? Editor is already wrapped in a `div`. We could just simplify this as:

```auto
const MarkdownPreviewer = () = <Editor />

```

Which raises the question why we even need that component.

I guess it would make more sense if Preview were inside MarkdownPreviewer, which it probably should be. This is the only serious complaint I have. If you moved that here, then you would need a `div` (or a Fragment) to wrap it.

The other components _could_ be functional components with hooks, but let’s not worry about that right now. I do find them unnecessarily verbose. One of the things I don’t like with how React is taught is that they teach that everything is a class and every class needs a constructor. You can set your initial state directly as a class property. And you don’t need to bind _this_ if you define your methods as arrow functions (which just inherit the enclosing _this_). So, we could do:

```auto
class Editor extends React.Component{
    state = { markdown: defaultText }
   
  handleChange = (e) => {
    this.setState({
      markdown: e.target.value
    })
  }
// ...

```

Which gets rid of 7 lines without loosing any function or clarity.

But those are nitpicky things. All in all, it’s well written, well organized React code. Have fun on the next project.

---

<div class="post-metadata">

**Author:** ![mariajoseamir](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mariajoseamir/32/183235_2.png) [@mariajoseamir](https://forum.freecodecamp.org/u/mariajoseamir)\
**Post date:** [October 7, 2020, 7:30pm UTC](https://forum.freecodecamp.org/t/markdown-previewer-frontend-libraries-project-feedback-needed/424546/3 "2020-10-07T19:30:12Z")

</div>

Thank you very much for taking your time to check my code, i appreciate every single advice that you give to me, it was really helpful thank you!  
All those advices are making me better coder even though you call it ‘nitpicky things’ i consider them ‘advices that i will be grateful in a future’.  
I will make those changes…!  
Thank you very much!

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [October 7, 2020, 7:55pm UTC](https://forum.freecodecamp.org/t/markdown-previewer-frontend-libraries-project-feedback-needed/424546/4 "2020-10-07T19:55:21Z")

</div>

Pretty soon you’ll be doing it for someone else. That’s what we do here.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 1:10pm UTC](https://forum.freecodecamp.org/t/markdown-previewer-frontend-libraries-project-feedback-needed/424546/5 "2021-06-01T13:10:17Z")

</div>

Closed on June 1, 2021, 1:10pm UTC


