-
-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathplugin.tsx
More file actions
29 lines (28 loc) · 699 Bytes
/
plugin.tsx
File metadata and controls
29 lines (28 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import type { JSX } from 'react'
import type { DevtoolsPanelProps } from './panel'
import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'
export function createReactPlugin({
Component,
...config
}: {
name: string
id?: string
defaultOpen?: boolean
Component: (props: DevtoolsPanelProps) => JSX.Element
}) {
function Plugin() {
return {
...config,
render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => (
<Component {...props} />
),
}
}
function NoOpPlugin() {
return {
...config,
render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => <></>,
}
}
return [Plugin, NoOpPlugin] as const
}