~/talk

React query and auth: Who is responsible for what?

Talkat React Day New York 2021 · on Tuesday, 2021-10-05· [react, security]
slides:none on file

A concrete recipe for auth plus server state: centralize user state in a useUser hook that initializes from localStorage, enables a user-specific react-query only when user exists, updates the cache via setQueryData on sign in/update/sign out, and keeps localStorage, internal state and react-query synchronized. Example app is a LazyDays spa with codes on GitHub. Notes on alternatives: npm packages like react-query-auth and react-query-firebase exist (about 504 and 32 weekly downloads respectively versus ~500k for react-query).

AI-written summary · about

  1. 0:00Introduction and welcome
  2. 1:02Talk overview and goals
  3. 3:08What is React Query?
  4. 6:37App assumptions and demo setup
  5. 8:02Client vs server state in auth
  6. 10:10Why use React Query for auth data
  7. 14:24Solution: Centralizing with useUser hook
  8. 20:49React Query Auth library overview
  9. 23:05React Query Firebase integration
  10. 24:31Conclusion and key takeaways
  11. 25:05Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.