react-attack 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  You can pass a react component or html element and append it where you want.
4
4
 
5
+ **React Attack** by [Dario Passariello](https://dario.passariello.ca) (c)
6
+
7
+ [![version](https://img.shields.io/npm/v/react-attack.svg)](https://npmjs.org/package/react-attack)
8
+ [![downloads](https://img.shields.io/npm/dm/react-attack.svg)](https://npmjs.org/package/react-attack)
9
+
10
+ ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
11
+ ![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
12
+ ![Jest](https://img.shields.io/badge/Jest-gray?logo=jest)
13
+ ![ESLint](https://img.shields.io/badge/ESLint-gray?logo=eslint)
14
+ ![webpack](https://img.shields.io/badge/webpack-gray?logo=webpack)
15
+
16
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
17
+
5
18
  ## install
6
19
 
7
20
  ```sh
@@ -9,10 +22,9 @@ npm i -D react-attack
9
22
  ```
10
23
 
11
24
  You use:
12
- If your app is an SPA you need to import only one time at first script
13
25
 
14
26
  ```javascript
15
- import "react-attack"
27
+ import ReactAttack from "react-attack"
16
28
  ```
17
29
 
18
30
  ## how works and use
@@ -21,7 +33,7 @@ import "react-attack"
21
33
 
22
34
  useEffect(
23
35
  () => {
24
- ReactGlue(
36
+ ReactAttack(
25
37
  "body", // <-- Append to body
26
38
  "component", // <-- ID of container
27
39
  <div>HTML</div> // <-- Example with HTML
@@ -43,7 +55,7 @@ import "react-attack"
43
55
 
44
56
  useEffect(
45
57
  () => {
46
- ReactGlue(
58
+ ReactAttack(
47
59
  "body", // <-- Append to body
48
60
  "component", // <-- ID of container
49
61
  <TestComponent /> // <-- React Component
@@ -60,14 +72,14 @@ import "react-attack"
60
72
  // Example in React to create a popup into body
61
73
 
62
74
  import React from "react"
63
- import ReactGlue from "react-attack"
75
+ import ReactAttack from "react-attack"
64
76
 
65
77
  const MyFunction = () =>{
66
78
 
67
79
  useEffect(
68
80
  () => {
69
81
 
70
- ReactGlue(
82
+ ReactAttack(
71
83
  "body",
72
84
  "component",
73
85
  <div
package/index.d.ts CHANGED
@@ -5,9 +5,9 @@
5
5
  https://dario.passariello.ca
6
6
  */
7
7
 
8
- declare module 'ReactGlue'
8
+ declare module 'ReactAttack'
9
9
 
10
- declare var ReactGlue
11
- type ReactGlue = {}
10
+ declare var ReactAttack
11
+ type ReactAttack = {}
12
12
 
13
- export default ReactGlue
13
+ export default ReactAttack
package/index.tsx CHANGED
@@ -1 +1 @@
1
- import r,{isValidElement as i}from"react";import{createRoot as d}from"react-dom/client";const a=(o,c,e)=>{const t=document.createElement("div");t.id=c;const n=document.querySelector(o);if(!n)throw"React Glue need the parent object in the scene";const l=n.appendChild(t);d(t).render(i(e)?e:r.createElement(r.Fragment,null,e))};export default a;
1
+ import r,{isValidElement as i}from"react";import{createRoot as a}from"react-dom/client";const d=(c,o,e)=>{const t=document.createElement("div");t.id=o;const n=document.querySelector(c);if(!n)throw"React Glue need the parent object in the scene";const m=n.appendChild(t);a(t).render(i(e)?e:r.createElement(r.Fragment,null,e))};export default d;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-attack",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "Render React where you want",
5
5
  "keywords": [
6
6
  "react-attack, react, render, component, glue, dario, passariello"