tharaka's avatar

Extracting components

When extracting components in Livewire, most of the time we are encouraged to extract a Blade component instead of a Livewire component because they are a lot simpler. I'm new to Laravel & Livewire, could someone guide me when I should extract a Livewire component instead of a Blade component?

0 likes
3 replies
jaseofspades88's avatar
Level 51

If your component needs its own behaviour, for example a button you might want to provide your users to leave a rating... this isn't going to be easy on a blade partial because that doesn't have an easy way to interface with your models.

Your components can be as big or as small as you require them and can have as complex or as simple functionality as you need.

Blade components I tend to use for things like buttons and links... Livewire components for things that 'do stuff'

1 like
tharaka's avatar

@jaseofspades88 I get it now. I'm coming from a React world. So this confused me a bit at first. Thanks for the help.

Please or to participate in this conversation.