Help with React Markdown Previewer

I´m having troubles making the Input from the text area go to the Marked interpreter (getting a TypeError: Cannot read property ‘value’ of null). Any ideas on how to fix it?

I think it looks like this.state.value isn’t available in your MarkdownExample component, as it’s not set there and isn’t passed in - perhaps pass the value in as a prop

1 Like

Thank you for the reply. I tried doing that using “props.state.value” but still won´t budge. Don´t know what I´m doing wrong.

it depends how you pass it in -
try something like this…
<Component nameOfProp={this.state.whateverYouWantToSend} />
then use it in the other component sort of like this…

1 Like

Tried that, still getting errors:

you tried something, but it doesn’t look like what I suggested

Sorry, I thought I was doing what you suggested. I guess I´m having troubles understanding how to pass props.

alright, let me try and be more specific…
<MarkdownExample value={this.state.value} />
then use it in that component like this…

Update: I think did what you suggested. But now I´m getting: “TypeError: this.props.value.getMarkdownText is not a function”

yea, that doesn’t look right - I suppose you better debug it

Yeah. I´m now stuck trying to make this function work, lol.

Fixed it! Had to redo a couple of things but now it works. One final question: how can I use the cdn test that Freecodecamp uses in React?

nice job - add this script somewhere in your project - probably somewhere after everything else to be safe

1 Like