Best way to "lazy" load into a component using Inertia and Laravel?
Hi!
So I have in my web apps severals components that should be able to work standalone.
Let's say I have a "group" picker on a student. The student might have the option to change its group, the teacher might have the option to change its group and the administration might have this option too.
If it's on 5 different pages, I would need to make the query "load all the groups" 5 different time in 5 different controllers.
Would there be a way to tell Inertia "when there is the component XYZ, retrieve all the groups only for this component" without having to include it in each page where it is loaded?
Well in both cases the solution is to use a store like pinia for VueJS and load the groups when the application is loading. Then instead of querying the database to retrieve the groups, you just have to retrieve the existing groups in the store.