react-sanitize-dom-props
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

React Sanitize DOM Props

This package helps to remove extra properties from object and leave only ones that are valid for passing to dom.

Usage

import { pickHTMLProps } from "react-sanitize-dom-props";
const props = {
    onClick: () => {},
    className: "container",
    foo: "bar"
}
 
const sanitizedPorps = pickHTMLProps(props, /* strict */ false);
/* {
    onClick: () => {},
    className: "container",
*/
import { isValidHTMLProp } from "react-sanitize-dom-props";
 
isValidHTMLProp("onClick" /* strict */ false); // true
isValidHTMLProp("onClick" /* strict */ true); // true
isValidHTMLProp("onclick" /* strict */ false); // true
isValidHTMLProp("onclick" /* strict */ true); // false

Readme

Keywords

none

Package Sidebar

Install

npm i react-sanitize-dom-props

Weekly Downloads

1,309

Version

0.0.1

License

MIT

Unpacked Size

141 kB

Total Files

58

Last publish

Collaborators

  • thomasmikava