Intepreting carriage return as <br/> with react markdown

I have made a markdown previewer using react and react-markdown .
All my tests pass except the Optional bonus where you have to interpret carriage returns as
.
Ive tried doing this:

handleChange(event){
		this.setState({text: event.target.value.match(/[\r\n|\r|\n]$/) ? event.target.value.replace(/\r\n|\r|\n|\s\s\r\n/g,`  \r\n`) : event.target.value});
	}

where event.target.value is the text which is being rendered in my preview

It appears to work but the tests still shows that it fails.
Is there an alternate/easier way to render carriage returns as
?

The markedjs library has an option for this, not sure about react-markdown. I see the <br> is on the allowedTypes list but I do remember seeing others having issues with this when using react-markdown. Don’t remember if there is a solution to this, but you should use the options the library comes with before trying to insert the element manually.

Not sure what the issue is, all the test does is add a string to the value property on the textarea element and does a .match on the innerHTML of the preview element.

Yeah i tried looking for an option in the library.
I found something about nodes but didn’t really understand it
Thanks anyway