Function
createReactPlugin
({
Component,
...config
}: {
name: string
id?: string
defaultOpen?: boolean
Component: (props: DevtoolsPanelProps) => JSX.Element
})
Source from the content-addressed store, hash-verified
| 3 | import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools' |
| 4 | |
| 5 | export function createReactPlugin({ |
| 6 | Component, |
| 7 | ...config |
| 8 | }: { |
| 9 | name: string |
| 10 | id?: string |
| 11 | defaultOpen?: boolean |
| 12 | Component: (props: DevtoolsPanelProps) => JSX.Element |
| 13 | }) { |
| 14 | function Plugin() { |
| 15 | return { |
| 16 | ...config, |
| 17 | render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => ( |
| 18 | <Component {...props} /> |
| 19 | ), |
| 20 | } |
| 21 | } |
| 22 | function NoOpPlugin() { |
| 23 | return { |
| 24 | ...config, |
| 25 | render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => <></>, |
| 26 | } |
| 27 | } |
| 28 | return [Plugin, NoOpPlugin] as const |
| 29 | } |
Tested by
no test coverage detected