how to pass data from controller to block in magento 2?
$block->setData('custom_parameter', 'Data from the Controller'); As a result, the block instance has new data assigned and it can be accessed via the getData() method. Alternatively, we can pass the name of the key to the getData(string $key = null, int $index = null) method.