How to properly pre-fetch (init) data from api to storage #860
Unanswered
vip9
asked this question in
Help and Questions
Replies: 1 comment
-
There is actually an example in the playground of this repo:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to use Pinia as transparent data storage (cache?) for api data between routes/components. I would like to use storage with knowledge, that the data is ready, and not calling api every simple request.
I am currently using such code:
I would rather use "constructor" or implement some action: init() function, and use only "state" variables directly.
Instead of the getter + function + if statement combo.
What is good practice for prefetching data into storage? How to do it right?
Regards,
Piotr
Beta Was this translation helpful? Give feedback.
All reactions