![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
react-sanitizer-parser
Advanced tools
react-sanitizer-parser is a React element sanitizer parser that utilizes the html-react-parser and dompurify libraries.
npm install react-sanitizer-parser
yarn add react-sanitizer-parser
import ReactSanitizerParser from './ReactSanitizerParser';
const Example = () => {
const dirty = `
<div>
<span>
React Sanitizer Parser
</span>
</div>
`;
return (
<ReactSanitizerParser>{dirty}</ReactSanitizerParser>
);
}
import ReactSanitizerParser from './ReactSanitizerParser';
const Example = () => {
const dirty = `
<div>
<span>
React Sanitizer Parser
</span>
</div>
`;
return (
<ReactSanitizerParser
htmlParserOptions={{ /* ...html-react-parser options */ }}
sanitizerConfig={{ /* ...dompurify config*/}}
>
{dirty}
</ReactSanitizerParser>
);
}
If you need to, you can use the parse
method of html-react-parser and DOMPurify's DOMPurify
directly.
import ReactSanitizerParser, { parse, DOMPurify } from "react-sanitizer-parser";
function App() {
console.log(DOMPurify.sanitize("<img src=x onerror=alert(1)//>")); // <img src="x">
return (
<>
{parse("<div>React</div>")}
<ReactSanitizerParser>{`<div>React</div>`}</ReactSanitizerParser>
</>
);
}
FAQs
react-sanitizer-parser
The npm package react-sanitizer-parser receives a total of 0 weekly downloads. As such, react-sanitizer-parser popularity was classified as not popular.
We found that react-sanitizer-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.