Markdown previewer: first problem encountered

Markdown previewer: first problem encountered
0.0 0

#1

Hi everyone.
I am trying to make my markdown previewer but even though I imported the “marked.js” library, when I try to use marked() I get:

‘marked’ is not defined no-undef

why is this?

EDIT: I had not installed react-marked. However now that I did. I get:

./src/Output/Output.js
Module not found: Can’t resolve ‘marked’ in ‘C:\Users\Usuario\markdown-previewer\src\Output’

EDIT 2: package.json dependencies are what they’re supposed to be. I restarted VSCode and now I get a completely different error (!):

Error: marked(): input parameter is undefined or null
marked
C:/Users/Usuario/markdown-previewer/node_modules/marked/lib/marked.js:1244
output
C:/Users/Usuario/markdown-previewer/src/Output/Output.js:12

12 | dangerouslySetInnerHTML = {{__html: marked(props.output)}}>

I’m losing my mind here .I appreciate yourhelp!

Thank you!


#2

Fixed! If anyone is curious I was just having problems receiving my input text in the Output component where I’m calling marked(), because I hadn’t included the ‘output’ property in the original state. Then I had some mixed up with event handlers because it’s my biggest issue with React. but I finally solved it :slight_smile: