Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

📝 Got some Saturday reading for ya! "How to control a React component with the URL" One of those lessons you can never hear too many times — duplicate state is a stubborn problem that can be easy to miss. Hope you enjoy!

51,860 görüntüleme • 1 yıl önce •via X (Twitter)

11 Yorum

François Best - 🦋 profil fotoğrafı
François Best - 🦋1 yıl önce

Great read Sam, thanks! Once you get into this pattern you notice a few things: - Not all state is a string - Browsers and servers have rate limits I made @nuqs47ng to help React devs switch from useState to URL state, reliably.

@chance.dev 🦋 profil fotoğrafı
@chance.dev 🦋1 yıl önce

Was just chatting with @DavidKPiano about how especially tricky this can be when modeling with state machines

JWWW profil fotoğrafı
JWWW1 yıl önce

Love to use URL as state! I wish more React devs would have learned this way to start. I think I’d personally maybe debounce that Router.push to prevent it from being called on every keystroke

Toby Flenderson profil fotoğrafı
Toby Flenderson1 yıl önce

I'm using url as state in a nextjs app with app router. router.push is pretty slow even in prod environment. I'm changing search params in router.push. Do you have any solution for this?

anthonie profil fotoğrafı
anthonie1 yıl önce

While this is great...I usually prefer it for serializable state that needs to be persisted on refresh. Like everything else...you just need to find the sweet spot. Great post Sam.👍

Dan Skiba profil fotoğrafı
Dan Skiba1 yıl önce

Hi, I've noticed that if you type really fast in the last example it gets really luggy and miss some changes. Example type '123456' - result might be '1246'

Jakub Jirous profil fotoğrafı
Jakub Jirous1 yıl önce

Thank you so much, Sam, for this amazing article. I’ve been following you for a while, and your content is one of the best resources on the internet. I can’t wait for your brand-new course!

Jannik Wempe profil fotoğrafı
Jannik Wempe1 yıl önce

Such a good post (again!). I wish my younger self would have read that post because he had to learn that the hard way 😅

Hassan profil fotoğrafı
Hassan1 yıl önce

Great read!

Mauricio Corzo profil fotoğrafı
Mauricio Corzo1 yıl önce

Great article!! Love to learn from you. Question? This can be done too with useSyncExternalStore()?

Sam Selikoff profil fotoğrafı
Sam Selikoff1 yıl önce

Yep but if your framework has something like a useSearchParams() hook you should just use that – I'm guessing it uses uSES under the hood

Benzer Videolar