The useSubmit Hook just got an upgrade... let's use it to build some optimistic UI in Remix!
🔗 LINKS
Code diff: gist.github.com/samselikoff/1b7d18b0aad30145e2f2a8c899fdf5bc
Save 40% on Build UI this week 👉 buildui.com/pricing
🕐 TIMESTAMPS
0:00 - Intro
0:45 - Removing the pending UI
1:46 - Accessing pending form data with useFetchers
6:30 - Adding optimistic data to the feed
8:16 - Immediately clearing the textarea
10:40 - Submitting the form on Enter
12:44 - Why useFetcher is wrong
14:48 - New API: useSubmit
19:03 - The problem: Race condition
20:10 - The refactor: Client-side UUIDs
29:02 - The solution: Filtering persisted records from the optimistic data
31:42 - Demo
34:15 - Final touch: Saving indicator
36:19 - Black Friday Deal!
21 ноя 2023