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
bigmistqke8mo 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
bigmistqke8mo 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
danboyle86378mo ago
I don't know why not... yet. Thanks I'll watch this tonight for sure. I appreciate it
bigmistqke
bigmistqke8mo ago
ur welcome!
Want results from more Discord servers?
Add your server
More Posts
Set Initial Route using @solidjs/routerHello, I have a simple Router setup with 3 routes/tabs inside my Main component ``` <Routes> <RoutIs it a good idea to make a real time chat app with SolidStart + ASP.NET?Hi. Me and a friend are making a real time chat app with solidjs and c#, first we tried with @microsProvider context isn't being executed on SSR website before child component?Hi, I'm working on a website for work and I'm attempting to insert a provider as the parent of a chCorrect method for passing form data between pagesFeeling like this is a super simple thing to do, I just cant figure it out from the docs. I have a fsolid-primitive/paginationcan somebody explain this?. here is the code of initiaze pagination. const [paginationProps, page] =Is it possible to have a route rerender only a portion of the page with Solid StartAs stated above I want to set up a page where sub routes rather than reloading the entire page just console.log asynch function delay the actual valuewhy console.log asynch function delay the actual value? . if no console.log i get the actual value. How to get previous route as search params?I tried <A> getting href before navigating from current path or route getting previous route from wiNesting startTransition calls arbitrarilyCan I nest `startTransition(() => { setState(); startTransition(() => setState()) })` calls arbitrarIssue with playground console errors on firefoxHi, I was using the playground on firefox when I noticed that errors are not being displayed in the