Search Docs
Loading...
Skip to content

Function: useOrderContext

function useOrderContext<A>(area): object;

Hook for reading and setting order context for a UI area.

Components wrapped with observer will automatically re-render when the context changes.

Type Parameters#

Type Parameter
A extends UIArea

Parameters#

ParameterTypeDescription
areaAThe UI area to get/set context for

Returns#

object

Object with context and setContext

NameType
contextUIAreaContext<A>
setContext()(ctx) => void

Example#

function MyCaptionStyleButton() {
const { context, setContext } = useOrderContext('ly.img.caption.panel');
return <button onClick={() => setContext({ view: 'style' })}>Styles</button>;
}