Context
In NocoBase, Context is the bridge connecting plugin code to NocoBase capabilities. Through the context, you can make requests, handle internationalization, write logs, navigate pages, and more.
There are two access entry points for the context:
- In Plugins:
this.context - In React components:
useFlowContext()(imported from@nocobase/flow-engine)
Both return the same object (a FlowEngineContext instance), just used in different scenarios.
Usage in Plugins
In a plugin's lifecycle methods such as load(), access the context via this.context:
Usage in Components
In React components, get the same context object via useFlowContext():
Plugin Shorthand Properties vs ctx Properties
The Plugin class provides some shorthand properties for convenient use in load(). However, note that some Plugin class shorthand properties and ctx properties with the same name point to different things:
The most commonly confused pair is this.router and ctx.router:
this.router(Plugin shorthand property) -> RouterManager, used to register routes (.add())ctx.router(context property) -> React Router instance, used for page navigation (.navigate())
Common Capabilities Provided by Context
Here is a list of common context capabilities. Note that some are only available in Plugins, some only in components, and some in both but with different syntax.
For detailed usage and code examples of each capability, see Common Capabilities.
Related Links
- Common Capabilities -- Detailed usage of ctx.api, ctx.t, ctx.logger, etc.
- Plugin -- Plugin entry point and shorthand properties
- Component Development -- Basic usage of useFlowContext in components

