Skip to content
Advertisement

ReactJs: TypeError: Cannot read property ‘length’ of undefined

I need to setup rich text box in my content body section, so I like to use npm react-quill It’s install succesfully then I have used a bubble them form react-quill It’s also warking succesfully. But when I try to show my post then display like this:

JavaScript

But I need to plain text with rich text editor. Then I have used npm install react-render-html.

After that when I try to see my post then show me error like this:

JavaScript

I have tried code like this:

JavaScript

Advertisement

Answer

I got the solution by this way:

JavaScript

Just I have to add this line: {renderHtml(post && post.content)}

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement