SolidJSS
SolidJSโ€ข3y agoโ€ข
4 replies
Nyantastic

Conditional fetching with createResource

Hi!
Alright, this might be a little bit silly but here's my problem:
I have a context provider component that fetches some data to be used later, with createResource. But I'm passing a boolean to the context provider as props, and I'd like the data to be fetched only if the boolean is set to true. What would be the best way to handle this?

I'll provide some code if needed but really it's just a simple createResource calling the simplest fetcher.
Thank you in advance, have a nice day!
Was this page helpful?