# react-dom-props

> We cannot set {...props} to DOM Element directly as there might be some non-supported props. And it would be tedious to map them one by one.

Latest version **2.0.0** (published 2019-06-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-dom-props
pnpm add react-dom-props
yarn add react-dom-props
bun add react-dom-props
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-06-08 |
| First published | 2017-03-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | 87hz |

## Links

- npm: https://www.npmjs.com/package/react-dom-props
- Repository: https://github.com/87Hz/react-dom-props
- Homepage: https://github.com/87Hz/react-dom-props#readme
- Issues: https://github.com/87Hz/react-dom-props/issues
- npm.io page: https://npm.io/package/react-dom-props

## Dependencies (1)

- [ramda](https://npm.io/package/ramda.md) ^0.26.1

## Recent versions

- 2.0.0 (latest) — 2019-06-08
- 2.0.0-rc3 — 2019-06-08
- 2.0.0-rc2 — 2019-06-08
- 2.0.0-rc1 — 2019-06-07
- 1.0.2 — 2017-03-13
- 1.0.1 — 2017-03-13
- 1.0.0 — 2017-03-13

## README

# react-dom-props

We cannot set {...props} to DOM Element directly as there might be some non-supported props. And it would be tedious to map them one by one.

In case of single DOM Element we would like to manipulate inside a component, `react-dom-props` provides what you need. It will simply pick supported DOM props as listed in `https://reactjs.org/docs/dom-elements.html`

### Install

```
yarn add react-dom-props
```

### Usage

```jsx
// simply import from package if you need both of them
import { pickHtmlProps, pickSvgProps } from 'react-dom-props';

// if you just need one of them, import the member explictly like below to reduce bundle size
import { pickHtmlProps } from 'react-dom-props/dist/pickHtmlProps';
import { pickSvgProps } from 'react-dom-props/dist/pickSvgProps';

export const MyComponent = props => {
  // some logic here

  // pick html or svg props supported by React
  const htmlProps = pickHtmlProps(props);
  const svgProps = pickSvgProps(props);

  // then pass htmlProps or svgProps to the DOM element you would like to manipulate
  return (
    // html tag
    <div {...htmlProps} />
    // OR svg tag
    <svg {...svgProps} />
  );
};
```

---
_Source: https://npm.io/package/react-dom-props · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
