Answering late, but from what I’ve tried, you don’t need to pass data to the view from the render function. Instead, public properties of your component class are automatically made accessible to the component view, as described in the “Passing Data To Components” part of the docs.
How to access slots and attributes with Blade Component Classes
I want to achieve the following:
I want to create a package with my own components. So for instance I have a card component.
The card component would be called with: Title Lorem Ipsum
Basicly I want to set an attribute in my component class that checks if the header slot is present and then add an attribute divideClasses='divide-y divide-blue-200" that I can return in the card.blade.php
If I follow the example(https://laravel.com/docs/8.x/blade#using-attributes-slots-within-component-class) and use a return function in the render() class and I add a $data['divideClasses'] in the return function, the variable is not reaching the blade file.
What is the correct way to achieve this?
Please or to participate in this conversation.