He is just using the Pinia Global State to provide the Router in the Global Scope, not for any kind of processing or etc.., sure he can do it another way, but this is just a simple direct approach.
Being a great library dev and being able to teach or explain something are not overlapping skills. Teaching and presenting concepts requires breaking something down logically in a way that flows from beginning to end. Whereas being a great library dev usually means seeing the entire system in all its complexity as a cohesive whole with no beginning and no end. Learning to write application code by reading code samples in documentation is a horrendous idea, because library devs are particularly interested in complex interactions and edge cases that you shouldn't be writing in your application code.
Thank you ...great tutorial .... one of the main reasons i switched from react to vue is Pinia ...really great, scaleable and easy state management Library :) :)
setup functions are always 'the win'.. I was wondering why we couldn't just use `export router = blarblar` before.. and I am glad to find out.. Oh, you CAN.. I was told it didn't work like that.. but that was when vue3 was not official yet.. so I am glad we get back to the easy way again.
Something is wrong with that code. Store shoudn't know about router. For example if button trigger loggout there should be method that call some store with user logout and in the next line should be router.push. If u want to encapsulate this code u should use composable.
For more expert Pinia content, check out VueMastery.com 🍍👉 vuemastery.com/courses/
Why does STORE need to manage routes at all? In my opinion, the storage should not contain logic at all, except for data modifications.
He is just using the Pinia Global State to provide the Router in the Global Scope, not for any kind of processing or etc.., sure he can do it another way, but this is just a simple direct approach.
Thank you for making Pinia we ❤ it!
It's funny seeing some comments criticise a CORE DEVELOPER WHO WROTE THE TOOLS he's discussing.
Being a great library dev and being able to teach or explain something are not overlapping skills.
Teaching and presenting concepts requires breaking something down logically in a way that flows from beginning to end. Whereas being a great library dev usually means seeing the entire system in all its complexity as a cohesive whole with no beginning and no end.
Learning to write application code by reading code samples in documentation is a horrendous idea, because library devs are particularly interested in complex interactions and edge cases that you shouldn't be writing in your application code.
Thank you ...great tutorial .... one of the main reasons i switched from react to vue is Pinia ...really great, scaleable and easy state management Library :) :)
setup functions are always 'the win'..
I was wondering why we couldn't just use `export router = blarblar` before.. and I am glad to find out.. Oh, you CAN..
I was told it didn't work like that.. but that was when vue3 was not official yet.. so I am glad we get back to the easy way again.
15:46 that PR you were talking about, is it merged yet? Does this work now?
yes, it works now
Something is wrong with that code. Store shoudn't know about router. For example if button trigger loggout there should be method that call some store with user logout and in the next line should be router.push. If u want to encapsulate this code u should use composable.
Debatable.
Absolutely right. Mixing those different concerns will bring troubles later
code font read hard .
somewhere SOLID is crying