Skip to content

When should I use query and when Elf? #58

Answered by luii
Londeren asked this question in Q&A
Discussion options

You must be logged in to vote

Hey Londeren,
im also using both elf and query and i undestand your dilemma.
First of all tanstack did wrote about this in their documentation: https://tanstack.com/query/v4/docs/guides/does-this-replace-client-state

In my opinion you can omit the entity state management on the client-side, for me it wouldn't make much sense to store them both on query and elf-entities because they could get out of sync when forgetting to update the respective entity store.
But if you want to use them you could do something like this:

// client.service.ts

@Injectable({providedIn: 'root'})
export class ClientService {

  public queryClientById(Id: ClientModel['Id']) {
      const queryKey = ['clients', 'c…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Londeren
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants