# @nathandevuono/dom-to-react

> A package that takes DOM nodes and transforms them into a React tree

Latest version **1.1.1** (published 2021-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nathandevuono/dom-to-react
pnpm add @nathandevuono/dom-to-react
yarn add @nathandevuono/dom-to-react
bun add @nathandevuono/dom-to-react
```

## 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 | 1.1.1 |
| Published | 2021-02-06 |
| First published | 2021-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nathan DeVuono |
| Maintainers | nathandevuono |

## Links

- npm: https://www.npmjs.com/package/@nathandevuono/dom-to-react
- Repository: https://github.com/NathanDeVuono/dom-to-react
- Homepage: https://github.com/NathanDeVuono/dom-to-react#readme
- Issues: https://github.com/NathanDeVuono/dom-to-react/issues
- npm.io page: https://npm.io/package/@nathandevuono/dom-to-react

## Dependencies (1)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2

## Recent versions

- 1.1.1 (latest) — 2021-02-06
- 1.0.4 — 2021-02-04
- 1.0.2 — 2021-02-04

## README

# DOM-to-React

It does what it says on the tin.

## Implementation

This library is basically a wrapper around `react-dom`'s render function to do some lifting for you in relation to loading attributes in as props.

## Usage

TL;DR - Function signature:
```ts
injectComponent(component: React.Component, element: Element, props = {}: Record<string, unknown>): void;
```

First include the package in your project:
```bash
npm i @nathandevuono/dom-to-react
```

Then use like this:

```js
import injectComponent from '@nathandevuono/dom-to-react';

import MyComponent from './components/MyComponent';

function injectMyComponent() {
    const myElement = document.querySelector('#my-element');

    injectComponent(MyComponent, myElement);
}

window.addEventListener("DOMContentLoaded", injectMyComponent);
```

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