Tanner Linsley Profile picture
⚔️ Sir Tan of the Stack 🎉 TypeScript 🌎 Web ⚛️Open Source Software💡UI/UX/DX 💼Co-Founder @NozzleIO 🛠Creator @tan_stack 👨‍👩‍👧‍👦@Ch_JesusChrist
Mar 18, 2022 6 tweets 2 min read
When I build libraries for React, ironically, I don't really use hooks like useState, useReducer, etc.

One of the best perks (and footguns) of managing your state *outside* of react is that you get to have full control over when a component should rerender. A great use case for this is when you need to call a bunch of state altering functions in succession. There's no waiting for your updates to come down the react pipeline, so you get up-to-date values immediately in your private state.
Mar 4, 2022 5 tweets 2 min read
"Can you open that button/link in a new tab?" can send (ultimately good) shockwaves through your app state:

- How easy is it for you to put that state in the URL?
- Is it complex/nested?
- Is it type safe?
- Can you update some/all of it?
- While also changing the path/hash? - Is that state stable between renders?
- Do all routes/paths now need to be aware of that state?
- When do you persist that state automatically? Can you?
- If you update only part of that state, are the parts that remained the same structurally equal?
Nov 15, 2021 16 tweets 4 min read
🎉🥳 Announcing #ReactLocation, a brand new router for React!

⏳ Async Loaders & Elements
🔀 Parallelized
⏲️ Prefetching
🗄 Caching
🔎 1st-class Integrated Search Params API
🗂 Code-Splitting
⚠️ Error/Pending/Timing States
🪆 Nested Layouts

react-location.tanstack.com

#TanStack ⏳ Async Route Loaders & Elements

Routes can define data dependencies and the elements they render as asynchronous functions that will be guaranteed to resolve before rendering the next location. The suspense is palpable! 😜
Jul 15, 2020 11 tweets 7 min read
@theefer @OliverJAsh I’ll respond more at my keyboard, but the simple solution to this is to adopt invalidation patterns over manual data normalization. Just invalidate all of the queries. They already know how to fetch the exact data they need. @theefer @OliverJAsh Regardless of React Query or not, normalized caches on the front-end come with the upside of fetching less data and using the responses of mutations as much as possible. When you like a tweet, you just go find that tweet in your store and update it

...
Jul 9, 2020 11 tweets 3 min read
Lots of talk about React suspense today. I’m very excited about it.

However, I feel like the patterns I’ve seen in #ReactQuery (and friends like SWR) have alone been more transformative for my own dev process and users and have even prepped me for suspense in a lot of ways. Of course, Suspense isn’t out yet, and the ecosystem will likely experience a smash of collective inovation around it when it comes out. That’s the exciting part. But what I feel like I’m starting to realize after playing around with it is that in the end,