blazor-405079-enable-interactive-render-mode.md
You can create applications that render content in static server-side render mode (static SSR). In this mode, components are rendered on the server and returned to the client without any interactivity.
Although most DevExpress Blazor components are interactive, you can use the following components in static render mode with limitations.
Enable interactivity for an individual component, a page, or the entire application to allow DevExpress components to execute scripts and display data without limitations.
To enable interactivity, ensure that required services and configuration are added in the Program.cs file:
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
...
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode();
If you specify interactive render mode for a DevExpress component, it can cause the following error: Cannot pass the parameter 'X' to component 'Y' with rendermode 'InteractiveServerRenderMode'. The reason for this error is that an interactive component cannot contain non-serializable parameters, such as render fragments.
To solve the issue, wrap the DevExpress component in a parent component that only has serializable parameters. The following code sample adds an interactive DxAccordion component to a static page.
Wrap the DxAccordion component in another component (WrapperComponent) that does not have parameters.
Add WrapperComponent to a static page.
Refer to the following topic for additional information: Child component with a serializable parameter
Add the @rendermode directive on the page to enable interactivity.
@rendermode InteractiveServer
Specify the @rendermode directive in HeadOutlet and Routes components to enable interactivity for the entire application.
<head>
@* ... *@
<HeadOutlet @rendermode="InteractiveServer" />
</head>
<body>
<Routes @rendermode="InteractiveServer" />
@* ... *@
</body>
Refer to the following topic for additional information: Apply a render mode to the entire app.