Which Livewire method should I use?
HTML-код
- Опубликовано: 3 окт 2024
- There's multiple different ways to pass data from your server into your Livewire components template or view layer. But how are all of these methods different? How are they similar? Which one do I actually use to get the data in the way I want it?
Well. Let's take a look. 👀
―
Links:
Livewire Lifecycle Hooks: livewire.larav...
Livewire Computed Properties: livewire.larav...
Please give us more videos with Josh on this channel! Love his content and style :)
Thanks for watching Robert! I'm glad I get to be a part of the team. :)
-Josh
Please 🙏 🙏🙏, I completely agree, his style is 👌
Thank you for this great video. I use Livewire in all my projects and it's amazing how I keep learning something new everyday.
It's really such a wonderful tool!
-Josh
Great job man. Been using livewire for a few years now took me a bit to also figure out exactly when to use which, especially the render method because it re-computes at every single refresh making it not the best place to fetch data from. I always try to not place anything in the render method if possible unless its absolutely required for this reason.
It's definitely helpful to know all of these things so that way you can decide when you need data to be "fresh". So it's nice to be conscious of when you're making a ton of database queries like you said. :)
If I'm having a CRUD setup where I want to refetch a list of items (much like a TODO list), after something has been added, having it in the Render is fantastic for that. But otherwise, it's probably not best, like you said. ☺️
-Josh
Great video Josh, took me a while to figure out computed properties. Thank you for the refresher :D
So glad that it was helpful! I appreciate the support. :)
-Josh
life saving video. Thank you josh
Thank you for watching. I'm glad it helped! :)
-Josh
Thanks for this great video. But I have a question: if I use livewire volt using functions api, and I want to populate a table, what does it look like?
I don't know if I fully understand what you're saying, but that should be the with() function in Livewire Volt functional API.
-Josh
Livewire not having slots 😢
Is there a way for computed and pagination property to have something like a loadMore?
It's definitely possible! You just have to use some Alpine to interact with the view window. I would check out a blog post like this to get some tips. :)
apexcode.dev/blog/infinite-scroll-with-laravel-and-livewire
-Josh
@@LaravelPHP Nice. Just like what I wanted.
How about some events that's being trigger inside a PostObserver created
Example. Window 1 created a new post
Window 2 has a Post List that's being paginated.
I can't wrapped up my head how to add the event data that I received and add it in the Post List. Do you have any reference that I could take a look at? Thank you so much.
if i do something like this with alipine js, will it get updated value of entangled livewire variable
Livewire:
public $pageState = null;
public function mount($state = null){
$this->pageState = $state;
}
Blade:
now will currentPageState have updated value or null ?
Thanks Josh ^_^
Thank YOU for watching!
-Josh
What is the name of the extensions for tailwind classes that you use?
Thanks for watching! That is the Tailwind Fold extension for VSCode. It's something new I found. :)
-Josh
Awesome.
Thank you! :)
-Josh
Create some video about protected listeners, dispatch for new livewire developers.
Good notes! We will add it to the list. :)
-Josh
Hello, what is the name of the font and theme you use? Thank you
This is the Dank Mono font with Catppuccin Frappe theme. :)
-Josh
@@LaravelPHPthank you :)
thanks
Thank you for watching! :)
-Josh