Skip to content

Documentation / @finchart/react / PluginProps

Interface: PluginProps<TApi> ​

Defined in: react/src/components/plugin.tsx:5

Type Parameters ​

TApi ​

TApi extends object

Properties ​

deps? ​

optional deps?: readonly unknown[]

Defined in: react/src/components/plugin.tsx:14

What reinstalls it — not the identity of install or onApi. Omit to install once per mount.


install ​

install: (plot, pane) => TApi | null

Defined in: react/src/components/plugin.tsx:12

Mounts the plugin — (plot, pane) => plot.use(…) or pane.use(…), the same function usePlugin takes. pane is the <ChartPane> this sits in, else mainPane. null means nothing to install for these deps.

Parameters ​

plot ​

Plot

pane ​

PaneApi

Returns ​

TApi | null


onApi? ​

optional onApi?: (api) => void

Defined in: react/src/components/plugin.tsx:24

Hears the api once it's installed and null before it's disposed — on unmount, on a deps change, and in StrictMode's round trip — so a parent's state never holds a disposed api. Read when the api is installed, and the callback that heard it is the one told it's gone; a new callback takes effect at the next install, so an inline arrow is fine.

Parameters ​

api ​

NoInfer<TApi> | null

Returns ​

void