react-sanitized
A React component that will sanitize user HTML code, using the popular sanitize-html
package.
Install
This React component requires react
as a peer dependency.
npm:
npm install react-sanitized --save
yarn:
yarn add react-sanitized
Example usage
import Sanitized from "react-sanitized"; const unsafeHtml = "<a href=\"http://github.com\" onClick=\"'>alert('test')>Github</a>"; ReactDOM;
It will output as:
Github
Options
You can add sanitize-html
options as props. For example,
<SanitizedHTML = =/>
Contribution
Like us? Star us.
Found an issue? File us an issue.