STOP using useState, instead put state in URL (in React & Next.js)

Published: 11 September 2023
on channel: ByteGrad
218,158
8.8k

👉 NEW React & Next.js Course: https://bytegrad.com/courses/professi...
Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship).
👉 Add auth to your app FAST: https://bit.ly/3QOe1Bh

👉 NEW React & Next.js Course: https://bytegrad.com/courses/professi...
👉 Professional JavaScript Course: https://bytegrad.com/courses/professi...
👉 Professional CSS Course: https://bytegrad.com/courses/professi...

👉 Discord: all my courses have a private Discord where I actively participate
🔔 Email newsletter (BIG update soon): https://email.bytegrad.com

⏱️ Timestamps:
0:00 Examples
0:41 Benefits
2:38 Example overview
4:24 useState
6:56 Synchronize URL with useEffect
7:30 History API
7:54 Query string definitions
8:58 Next.js useRouter
10:20 location.search
11:18 Problems with useState approach
11:58 Switch to URL for state
12:26 useSearchParams
13:35 Link component
16:11 Server component (searchParams)
17:13 Caveat 1: replace vs push
17:57 Caveat 2: unknown values
18:18 Caveat 3: no values
18:32 Caveat 4: url-encoded values (URLSearchParams)
20:47 Real-world use cases

#webdevelopment #programming #coding


Watch video STOP using useState, instead put state in URL (in React & Next.js) online without registration, duration hours minute second in high quality. This video was added by user ByteGrad 11 September 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 218,158 once and liked it 8.8 thousand people.