O3 Framework / useRenderableExtensions
useRenderableExtensions(
name):FC<Pick<ExtensionProps,"state">>[]
Defined in: packages/framework/esm-react-utils/src/useRenderableExtensions.tsx:121
This is an advanced hook for use-cases where its useful to use the extension system,
but not the ExtensionSlot component’s rendering of extensions. Use of this hook
should be avoided if possible.
Functionally, this hook is very similar to the ExtensionSlot component, but whereas
an ExtensionSlot renders a DOM tree of extensions bound to the slot, this hook simply
returns the extensions as an array of React components that can be wired into a component
however makes sense.
Each extension keeps the same component for as long as it stays in the slot, so passing it new state updates the mounted extension rather than remounting it.
string
The name of the extension slot
FC<Pick<ExtensionProps, "state">>[]
const extensions = useRenderableExtensions('my-extension-slot');
return (
<>
{extensions.map((Ext, index) => (
<React.Fragment key={index}>
<Ext state= />
</React.Fragment>
))}
</>
)