Setu-TS
    Preparing search index...

    Function renderView

    • Renders a view component with the given props and writes the result as the request's HTML response.

      The engine is resolved per request from ctx.services, so a replacement provider registered under CAPABILITIES.VIEW is honored exactly like it is for the @Render branch.

      Type Parameters

      • P

        The component's props bag

      Parameters

      • ctx: IRequestContext

        The current kernel request context

      • component: Component<P>

        The view component to render

      • props: P

        The props passed to the component

      Returns Promise<HandlerResult>

      The handler result carrying the text/html; charset=utf-8 body

      When no CAPABILITIES.VIEW provider is registered — register ViewPlugin (or any other provider of the token) first

      When the component throws or returns a value with no string form

      When the tree holds a pending <Suspense> boundary

      import { renderView } from '@setu-ts/view-plugin';

      router.get('/users', (ctx) => renderView(ctx, UserList, { users }));

      0.6.0