Skip to content
Bunshi
GitHub

useMolecule

useMolecule<T>(mol, options?): T

Get an instance from a MoleculeOrInterface

This will use the implicit scope of the component that calls this hook. If the component is wrapped in a ScopeProvider then that scope will be used here.

Scope can also be provided explicitly to this hook. This is useful when you already have access to an ID or other value that represents scope.

Type parameters

ParameterDescription
Tthe type of the molecule or interface, and the type of interface returned

Parameters

ParameterTypeDescription
molMoleculeOrInterface< T >a molecule or interface
options?MoleculeScopeOptionsallows for setting scope explicitly

Returns

T

a instance provided by the molecule

Source

src/react/useMolecule.tsx:24