I made Markdown previewer in Vscode and it was working completely fine. Now, I am trying to put the code in CodePen. I have made the necessary changes, but still my react app is not showing up. Could anyone please have a look into this and help me out.
There is nothing wrong with your markdown - it is a JS problem in a library, I think.
When I open up your console window, I see:
TypeError: Cannot read property ‘replace’ of undefined
Please report this to https://github.com/chjj/marked.
at Lexer.lex (marked.js:138)
// …
So, that is an issue in with marked. You are calling marked, it is in the render method of MarkdownPreviewer with marked(props.markdown). If I put console.log(props.markdown); on the line before the return for that method, I see that it is undefined. My guess is that that marked function is expecting something other than undefined.
Thanks @kevinSmith for hinting the problem. I was looking into it after reading your comment. I made two changes to the code and it worked:
As pointed by you, I realised that the components MarkdownEditor and MarkdownPreviewer were not getting data as props from Redux. I didn’t connect them properly with Redux. So, I updated the code as: