Closed jacksleight closed 1 year ago
At this time, it's complicated to have traits that override lifecycle hooks of Livewire when using the functional API. So, you have two options there:
mount
function. Something like this:uses(YourTrait::class);
mount(fn () => $this->myMount());
Was advised to repost this from https://github.com/livewire/livewire/discussions/6158, not sure if it counts as a feature request or a bug:
I'm using a trait in a Volt component and I'd like to define a mount method in that trait that will be used by all components that implement it, rather than defining it for every component with the mount function. However at the moment the trait's mount method is not being called, even though I'm not using Volt's mount function.
This may also apply to other lifecycle methods, I've not tested those.