Skip to content

Commit 8e33895

Browse files
committed
Use the reactjs bundle included withi @reactpy/client
1 parent af9a90d commit 8e33895

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/js/bun.lockb

2.03 KB
Binary file not shown.

src/js/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
"check": "prettier --check . && eslint"
55
},
66
"devDependencies": {
7-
"@types/react": "^18.3.11",
8-
"@types/react-dom": "^18.3.1",
97
"eslint": "^9.13.0",
108
"eslint-plugin-react": "^7.37.1",
119
"prettier": "^3.3.3"
1210
},
1311
"dependencies": {
14-
"preact": "^10.24.3"
12+
"@reactpy/client": "^1.0.3"
1513
}
1614
}

src/js/src/components.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import React from "preact/compat";
2-
import ReactDOM from "preact/compat";
1+
import { React } from "@reactpy/client";
32
import { createLocationObject, pushState, replaceState } from "./utils";
43
import { HistoryProps, LinkProps, NavigateProps } from "./types";
54

65
/**
76
* Interface used to bind a ReactPy node to React.
87
*/
9-
export function bind(node) {
8+
export function bind(node: HTMLElement | Element | Node) {
109
return {
11-
create: (type, props, children) =>
12-
React.createElement(type, props, ...children),
13-
render: (element) => {
14-
ReactDOM.render(element, node);
10+
create: (
11+
type: string,
12+
props: Record<string, unknown>,
13+
children: React.ReactNode[],
14+
) => React.createElement(type, props, ...children),
15+
render: (element: HTMLElement | Element | Node) => {
16+
React.render(element, node);
1517
},
16-
unmount: () => ReactDOM.unmountComponentAtNode(node),
18+
unmount: () => React.render(null, node),
1719
};
1820
}
1921

0 commit comments

Comments
 (0)