react-attack
Version:
Append your component in any part of your html using react-attack
60 lines (42 loc) • 1.67 kB
Markdown

[](https://npmjs.com/package/react-attack)
You can pass a react component or html element and append it where you want.
**React Attack** by [Dario Passariello](https://dario.passariello.ca) (c)
[](https://npmjs.org/package/react-attack)
[](https://npmjs.org/package/react-attack)




```sh
npm i -D react-attack
```
You use:
```javascript
import ReactAttack from "react-attack"
```
```js
ReactAttack(
"body", // <-- Append to body
"component", // <-- ID of container
<div>HTML</div> // <-- Example with HTML
)
or using a component
// You create a component on-fly as Test + useState!
const TestComponent = () => {
const [test, setTest] = useState("Hello World")
return (
<div>
<h1>{test}</h1>
</div>
)
}
ReactAttack(
"body", // <-- Append to body
"component", // <-- ID of container
<TestComponent /> // <-- React Component
)
```