We can pass custom data to view the page by using StorefrontRenderEvent
public static function getSubscribedEvents(): array
{
return [
StorefrontRenderEvent::class => ‘onStorefrontRender’
];
}
public function onStorefrontRender(StorefrontRenderEvent $event)
{
$route = $event->getRequest()->get(’_route’);
if($route == ‘frontend.product.reviews’)
{
$event->setParameter(‘testParam’, ‘testParamValue’);
}
}