Загрузка...

Nuqs Crash Course - The Best URL State Manager

In modern SPAs, we often leave the URL behind, treating state purely in memory. But the URL is powerful—it allows for linking, bookmarking, and better navigation.

In this crash course, we explore nuqs, a type-safe library that makes syncing your React state with the URL search parameters effortless. We cover everything from simple string parsing to managing complex JSON objects with Zod.

⚡ What You'll Learn:

- Setup: Installing nuqs and wrapping your app in the Adapter.
- Basic State: Using useQueryState to replace useState.
- Navigation Options: Controlling history (Push vs. Replace), scrolling, and clearing defaults.
- Type-Safe Parsers: Handling Integers, Floats, Booleans, Arrays, and Dates.
- Batch Updates: syncing multiple keys at once with useQueryStates.
- Advanced: Validating complex state with JSON and Zod schemas.

🔗 Links & Resources
Nuqs Docs: https://nuqs.dev/

⏳ Timestamps
0:00 - Intro: URL State vs Memory State
0:39 - Installation & Provider Setup
1:39 - Basic Usage: useQueryState
2:52 - Options: History, Scroll & Shallow Routing
4:47 - Data Parsers (Numbers, Boolean, Dates, Arrays)
7:50 - Managing Multiple States (useQueryStates)
9:15 - Advanced: JSON Parsing & Zod Validation

🔊 Music License:
Savfk - The Grid is under a Creative Commons BY 4.0 license.
https://creativecommons.org/licenses/...
/ savfkmusic
Music powered by BreakingCopyright: • 'The Grid' by @SavfkMusic 🇮🇹 | Epic Musi...
🔎 Find more music here: https://breakingcopyright.com

#ReactJS #NextJS #WebDev #StateManagement #TypeScript #nuqs #Frontend

Видео Nuqs Crash Course - The Best URL State Manager канала Code Genix
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять