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#

Parameter Type Description
area A The UI area to get/set context for

Returns#

object

Object with context and setContext

Name Type
context UIAreaContext<A>
setContext() (ctx) => void

Example#

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