Render FlowModel
FlowModelRenderer is the core React component for rendering a FlowModel. It is responsible for converting a FlowModel instance into a visual React component.
Basic Usage
FlowModelRenderer
FieldModelRenderer
For controlled field Models, use FieldModelRenderer to render:
Props
FlowModelRendererProps
showFlowSettings Detailed Configuration
When showFlowSettings is an object, the following configurations are supported:
Rendering Lifecycle
The entire rendering cycle calls the following methods in order:
- model.dispatchEvent('beforeRender') -
beforeRenderevent - model.render() - Executes the model's render method
- model.onMount() - Component mount hook
- model.onUnmount() - Component unmount hook
Usage Examples
Basic Rendering
Rendering with Flow Settings
Custom Toolbar
Skipping Auto Flows
Field Model Rendering
Error Handling
FlowModelRenderer has a comprehensive built-in error handling mechanism:
- Automatic Error Boundary:
showErrorFallback={true}is enabled by default - Auto Flow Errors: Catches and handles errors during the execution of auto flows
- Rendering Errors: Displays fallback content when model rendering fails
Performance Optimization
Skipping Auto Flows
For scenarios where auto flows are not needed, you can skip them to improve performance:
Reactive Updates
FlowModelRenderer uses the observer from @formily/reactive-react for reactive updates, ensuring that the component automatically re-renders when the model's state changes.
Notes
- Model Validation: Ensure the passed
modelhas a validrendermethod. - Lifecycle Management: The model's lifecycle hooks will be called at the appropriate times.
- Error Boundary: It is recommended to enable the error boundary in a production environment to provide a better user experience.
- Performance Consideration: For scenarios involving rendering a large number of models, consider using the
skipApplyAutoFlowsoption.

