#When to use resource?
5 messages · Page 1 of 1 (latest)
if it solves your problem and simplifies your architecture, you're fine to use it i guess.
It allows an async operation to be used inside a signals flow.
- run an operation whenever a signal has changed
- have a state for that operation like isLoading, hasValue, and error as signals
it's up to you whether you use the state in a further computed signal or just directly use it in a template or don't use it at all. Although, if not using the state, you can just use an effect instead. Whatever you prefer.
@north hill thanks you for your quick answer do you have any links or official discussion that go in your direction or is it just personal deduction?
resource is basically a computed but for async.
@scenic bone thanks for the clarification