Skip to content

Commit 623596d

Browse files
committed
simplify bind logic
1 parent 34d925b commit 623596d

File tree

1 file changed

+1
-6
lines changed
  • src/js/packages/@reactpy/client/src

1 file changed

+1
-6
lines changed

src/js/packages/@reactpy/client/src/bind.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ function reactjs_bind(node: HTMLElement, React: any, ReactDOM: any) {
3838
create: (type: any, props: any, children?: any[]) =>
3939
React.createElement(type, props, ...(children || [])),
4040
render: (element: any) => {
41-
if (!root) {
42-
const existingRoot = roots.get(node);
43-
if (existingRoot) {
44-
existingRoot.unmount();
45-
roots.delete(node);
46-
}
41+
if (!root && !roots.get(node)) {
4742
root = ReactDOM.createRoot(node);
4843
roots.set(node, root);
4944
}

0 commit comments

Comments
 (0)