Next examples assume assume you understand the topics in basic tutorial and you have read the API section. They also assume that you are familiarized with the syntax used when querying a provider created with the addon @data-provider/axios.
When querying a selector, the
query value is received the selector function, so, we can use it to filter the results of the selector dependencies:
We have named this example as "Filtering results in client side" only for better comprehension. This is true only in case that the selector dependency is an origin requesting to the server. If the dependency is an origin reading from
localStorage, for example, the filtration will always be made in client side, no matter if you delegate the query to the dependency or not.
query value can be used to query the selector dependencies, so we can also do:
But, why not to use the query method of the provider directly? We are not doing really nothing in the selector. This example makes sense when we add another property to the query:
As we have mention in the previous example, the title of this example is not exactly true, as server side or client side does not concern to Data Provider. This is only true when we are using an origin that requests to the server. The important thing here to is understand how can we pass the selector query to the dependencies.
When we define a selector dependency as a function, it will receive the value of the selector query, and the results of previous dependencies (as described in the Selector API page).
Let's see how can we use that behavior in a real app: