Skip to content

The naming convention behind _def and _ctx #64

Answered by lukemorales
lukaszmakuch asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @lukaszmakuch everything exposed for you through the typesystem is supposed to be used. The only reason they start with _ is to differentiate that these are "internal" properties auto generated by the lib, and not something yourself has declared as an entry key (if you try to create a key starting with _ you will have a runtime error), and also to not create a deny list of common property names you can't use.
These properties serve to give you access to some features like the query definition _def e.g., the fundamental query key to a composable query key (the _def of ['users', { userId: 1 }] is ['users']), or to give you access to contextual queries like shown in the docs.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lukemorales
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