UNPKG

react-attack

Version:

Append your component in any part of your html using react-attack

60 lines (42 loc) 1.67 kB
# [react attack](https://npmjs.com/package/react-attack) ![image](https://raw.githubusercontent.com/passariello/container/refs/heads/main/reactattack/reactattack.jpg) [![NPM](https://nodei.co/npm/react-attack.png?stars=true&downloads=true)](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) [![version](https://img.shields.io/npm/v/react-attack.svg)](https://npmjs.org/package/react-attack) [![downloads](https://img.shields.io/npm/dm/react-attack.svg)](https://npmjs.org/package/react-attack) ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript) ![React](https://img.shields.io/badge/React-gray?logo=react) ![ESLint](https://img.shields.io/badge/ESLint-gray?logo=eslint) ![License](https://img.shields.io/badge/license-MIT-blue.svg) ## install ```sh npm i -D react-attack ``` You use: ```javascript import ReactAttack from "react-attack" ``` ## how works and use ```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 ) ```