Regular Solid - the Correct way to use createResource?

In my app, on my Dashboard view, I am using createResource to get my user data. I'm then just updating another user signal with data returned from the createResource. I'm doing this because this user signal is used through out the app... so when it's populated the correct data is displayed. But this has me thinking... why not just use regular fetch in an onMount to get the data and update the user signal. What is the correct way to use createResource? You don't want to have an "instance" of createResource all over your app do you? That doesn't make sense to me.
4 Replies
bigmistqke
bigmistqke15mo ago
You don't want to have an "instance" of createResource all over your app do you? That doesn't make sense to me.
why not? it's a signal + added capabilities for async (suspense, transitions).
bigmistqke
bigmistqke15mo ago
https://www.youtube.com/watch?v=oQ1zn7cdtyU&t=13s is a nice talk about suspense, transitions and how resources play a part in that
danboyle8637
danboyle8637OP15mo ago
I don't know why not... yet. Thanks I'll watch this tonight for sure. I appreciate it
bigmistqke
bigmistqke15mo ago
ur welcome!
Want results from more Discord servers?
Add your server