This commit is contained in:
@@ -1,10 +1,26 @@
|
||||
/** biome-ignore-all lint/complexity/noBannedTypes: {} is the "empty props" type in React */
|
||||
import type { Node, NodePathMap } from "godot"
|
||||
import * as React from "react"
|
||||
import * as Reconciler from "./Reconciler.js"
|
||||
|
||||
|
||||
const ConcurrentRoot = 1
|
||||
|
||||
export const render = (element: React.ReactNode, container: Node<NodePathMap>, callback?: () => void): number => {
|
||||
export const renderComponent: {
|
||||
(
|
||||
container: Node<NodePathMap>,
|
||||
component: React.FC<{}>,
|
||||
): void
|
||||
<P>(
|
||||
container: Node<NodePathMap>,
|
||||
component: React.FC<P>,
|
||||
props: NoInfer<P>,
|
||||
): void
|
||||
} = (
|
||||
container: Node<NodePathMap>,
|
||||
component: React.FC<{}>,
|
||||
props?: Record<string, unknown>,
|
||||
): void => {
|
||||
const reconciler = Reconciler.make()
|
||||
|
||||
if (!(container as any)._rootContainer)
|
||||
@@ -18,10 +34,9 @@ export const render = (element: React.ReactNode, container: Node<NodePathMap>, c
|
||||
console.error,
|
||||
)
|
||||
|
||||
return reconciler.updateContainer(
|
||||
element,
|
||||
reconciler.updateContainer(
|
||||
React.createElement(component, props),
|
||||
(container as any)._rootContainer,
|
||||
null,
|
||||
callback,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user