It was replaced with the renderer service:.
$rendered$render_service = \Drupal::service('renderer')->render($renderArray);
The change record is slightlyAs mpdonadio and 4k4 have pointed out of date;in the method iscomments, to prevent metadata from bubbling up to the main request, you should execute this in a new render context. You can do so by using the renderrenderPlain
method, rather than the usual renderElementrender
these daysmethod (unless you're returning this from a controller, in which case use renderRoot
instead).
$rendered = $render_service->renderPlain($build);