jquery-react-render 1.5.0 → 1.5.1

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.
Files changed (3) hide show
  1. package/README.md +74 -0
  2. package/index.cjs +5 -3
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # [jquery react render](https://npmjs.com/package/jquery-react-render)
2
+
3
+ If you love to use Jquery and react... this is for you!
4
+ You can pass a react component or html element and append it where you want... in react style
5
+
6
+ **jquery-react-render** by [Dario Passariello](https://dario.passariello.ca) (c)
7
+
8
+ [![version](https://img.shields.io/npm/v/jquery-react-render.svg)](https://npmjs.org/package/jquery-react-render)
9
+ [![downloads](https://img.shields.io/npm/dm/jquery-react-render.svg)](https://npmjs.org/package/jquery-react-render)
10
+
11
+ ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
12
+ ![jquery](https://img.shields.io/badge/jquery-gray?logo=jquery)
13
+ ![ESLint](https://img.shields.io/badge/ESLint-gray?logo=eslint)
14
+ ![ESBuild](https://img.shields.io/badge/ESBuild-gray?logo=ESBuild)
15
+
16
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
17
+
18
+ > [!NOTE]
19
+ > If you have intention to use exclusively in react please, use ["REACT-ATTACK"](https://www.npmjs.com/package/react-attack) instead.
20
+
21
+ ## install
22
+
23
+ ```sh
24
+ npm i -D jquery-react-render
25
+ ```
26
+
27
+ You use:
28
+ If your app is an SPA you need to import only one time at first script
29
+
30
+ ```js
31
+ import "jquery-react-render"
32
+ ```
33
+
34
+ ## Example in vanilla js
35
+
36
+ ```js
37
+
38
+ $("body").react( // The main element where you want you component
39
+ "#jrr", // example: the name of container
40
+ <div>
41
+ This is just a test
42
+ </div>
43
+ )
44
+
45
+ ```
46
+
47
+ ## Example in React
48
+
49
+ ```js
50
+
51
+ import react from "React"
52
+ import "jquery-react-render"
53
+
54
+ export const Test = () => {
55
+
56
+ useEffect(
57
+ ()=>{
58
+ $("body").react( // The main element where you want you component
59
+ "#jrr", // example: the name of container
60
+ <div>
61
+ This is just a test
62
+ </div>
63
+ )
64
+ },[]
65
+ )
66
+
67
+ return <div>TEST</div>
68
+
69
+ }
70
+
71
+ ```
72
+
73
+ Copyright by Dario Passariello (c) 2025
74
+ all rights reserved - <dariopassariello@gmail.com>
package/index.cjs CHANGED
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  var e = require("react-dom/client");
2
4
 
3
5
  function t(e) {
@@ -11,9 +13,9 @@ var r = t(require("jquery"));
11
13
  globalThis.$ = r.default, globalThis.jQuery = r.default, r.default.fn.react = function(t, a) {
12
14
  const l = r.default(t);
13
15
  l.length > 0 && l.remove();
14
- const u = document.createElement("div");
15
- return t.startsWith("#") ? u.id = t.slice(1) : t.startsWith(".") && (u.className = t.slice(1)),
16
- this.append(u), e.createRoot(u).render(a), this;
16
+ const s = document.createElement("div");
17
+ return t.startsWith("#") ? s.id = t.slice(1) : t.startsWith(".") && (s.className = t.slice(1)),
18
+ this.append(s), e.createRoot(s).render(a), this;
17
19
  };
18
20
 
19
21
  var a = r.default.fn.react;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jquery-react-render",
3
3
  "code": "jqueryReactRender",
4
- "version": "1.5.0",
4
+ "version": "1.5.1",
5
5
  "description": "Render React Component Using Jquery",
6
6
  "keywords": [
7
7
  "jquery-react-render",