Open ghost opened 6 years ago
@johnunclesam have you considered using a json formatted string instead ? I tried using the html output too, but soon realized it wasn't particularly a good idea to dangerouslySetInnerHTML thus I switched to saving my editor input as a string.
Like this onContentStateChange = (content) => { var input = JSON.stringify(content) this.setState({content:input}) }
I'm learning React: totally newbie.
If I save in DB the HTML directly from
react-draft-wysiwyg
(is it a best practice?) and then in a view page of my React SPA I retrieve HTML from DB through my API:QUESTIONS:
how can I render that HTML?
dangerouslySetInnerHTML? Or maybe one of this (what do you suggest?)?
I read words like "sanitize", "securing HTML". But how, there is a library?
I need to secure html from draft-js when I save it in DB or after, when I'm rendering it?