Skip to content
Source
Sign inSign up
TanStack/devtools
Open History to see the last commit

class-mount-impl.tsx

28 lines675 Bytes

1/** @jsxImportSource solid-js - we use Solid.js as JSX here */
2​
3import { lazy } from 'solid-js'
4import { Portal, render } from 'solid-js/web'
5​
6import type { JSX } from 'solid-js'
7import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'
8​
9export function __mountComponent(
10 el: HTMLElement,
11 props: TanStackDevtoolsPluginProps,
12 importFn: () => Promise<{
13 default: (props: TanStackDevtoolsPluginProps) => JSX.Element
14 }>,
15): () => void {
16 const Component = lazy(importFn)
17​
18 return render(
19 () => (
20 <Portal mount={el}>
21 <div style={{ height: '100%' }}>
22 <Component {...props} />
23 </div>
24 </Portal>
25 ),
26 el,
27 )