No video

In-Place Optimistic UI

  Рет қаралды 8,015

Remix

Remix

Күн бұрын

Пікірлер: 26
@JEsterCW
@JEsterCW 8 ай бұрын
Lovely, I love this series of quick videos and the trick with flush is nice to know since the flick even for me is barely noticeable even if i do focus lmao
@luizhrocha
@luizhrocha 4 ай бұрын
I’d never find out how to fix this flicker problem without this.
@frozen_tortus
@frozen_tortus 8 ай бұрын
you are the chosen one. focus managment with useefect or, death, death is better
@shivamjhaa
@shivamjhaa 8 ай бұрын
I was waiting for this video all day. Thanks
@yomaru_1999
@yomaru_1999 7 ай бұрын
OMG I learn so much from this
@rafaeljdm
@rafaeljdm 8 ай бұрын
Please Ryan, give us the code :p
@antonbyrna3388
@antonbyrna3388 8 ай бұрын
It would be easier to remove button altogether and leave just text input and style it with :focus pseudo class. This would help to remove all this hacky flushSync and changing props values
@anttihilja
@anttihilja 8 ай бұрын
That's what I've done too. The tailwind pseudo classes can get pretty gnarly if the field is required, has error validation, animations, and other design requirements.
@jareddiscipio1768
@jareddiscipio1768 8 ай бұрын
@@anttihiljacan u share some code showing the gnarliness of tailwind in those situations? I’m starting a new project (remix, prisma, tailwind). So far it’s been a dream but I am starting to have some trouble with styling a component based on if the error state exists
@Callerooo
@Callerooo 8 ай бұрын
I learned to never mutate props. Is that not true? I see you mutate value during the post and revalidation.
@taquanminhlong
@taquanminhlong 8 ай бұрын
Same 😂 In that case I would use the useMemo derived from fetcher.formData.get(field) and revalidated value
@yarapolana
@yarapolana 8 ай бұрын
I am mindblown, I didn’t know it is technically a let. I would have used useState and do a whole bunch of extra code😂
@ReactTipsWithBrooks
@ReactTipsWithBrooks 8 ай бұрын
You should never mutate a prop, meaning if something like an object is passed in you should not mutate the values in that object. The reason being a) you may know what else is relying on that prop, and b) you might not know when React is going to re-render and re-change the value of that prop However, what Ryan is doing here isn't mutation, he's just reassigning the prop let a = { key: 'this thing' } a = { key: 'that thing' } The object originally assigned to a wasn't mutated, the variable a was just reassigned a new value. All that const does is says "a can never be reassigned" a.key = 'new value' Anyway, all that to say if this makes you nervous, you can just declare a new variable const copyOfProp = prop Hope that helps!
@yarapolana
@yarapolana 8 ай бұрын
@@ReactTipsWithBrooks Amazing explanation! Always helping the community ❤
@Mankepanke
@Mankepanke 8 ай бұрын
To be even more clear, it's the destructuring that declares new aliases for the values. Consider: let {a, b} = props; This is essentially the same as: let a = props.a; let b = props.b; You are now free to reassign `a` or `b` without mutating `props`. If you would mutate the thing _inside_ of `a` or `b`, for instance by doing `a.push()` or something, then `props` will be mutated to. But reassignment just means that `a` or `b` are no longer pointing to values inside `prop`.
@xHomu
@xHomu 8 ай бұрын
6:32 wait wait, props are lets?
@RyanFlorence
@RyanFlorence 8 ай бұрын
Technically `var` but the kids don't know what that is.
@jorgerobertotomaz3103
@jorgerobertotomaz3103 8 ай бұрын
Is there a way to reset the form data from fetcher last value to null or something like that ?
@danthareja448
@danthareja448 8 ай бұрын
What happens if the network request fails?
@Mankepanke
@Mankepanke 8 ай бұрын
It depends on what the action returns when that happens. Assuming it returns normally (i.e. some JSON) instead of throwing an error or alternative response, then the revalidation will kick in the same and reload the data from the server. The component will re-render with the old name, and the action's JSON available through the fetcher. If it *does* throw, then Remix will want to render an error component AFAIK.
@aghileslounis
@aghileslounis 8 ай бұрын
You need to handle if the request fails and go back to the initial value before the request was sent
@benoitaverty5455
@benoitaverty5455 7 ай бұрын
Remix will do that automatically. It'll fetch the actual data from the server wheter it changed successfully or not.
@AndersonSousa33
@AndersonSousa33 8 ай бұрын
About "let" and "const" typescript doesnt let me use let when I want ahhahahah
@maskedvillainai
@maskedvillainai 8 ай бұрын
So confused. What is this. What are you doing or trying to do. Literally 100% of context missing from this video. What platform? Why what who when this is so confusing.
@JakeRuesink
@JakeRuesink 8 ай бұрын
You must be a villain ai
Optimistic Add
22:34
Remix
Рет қаралды 7 М.
ISSEI & yellow girl 💛
00:33
ISSEI / いっせい
Рет қаралды 25 МЛН
Get 10 Mega Boxes OR 60 Starr Drops!!
01:39
Brawl Stars
Рет қаралды 19 МЛН
Matching Picture Challenge with Alfredo Larin's family! 👍
00:37
BigSchool
Рет қаралды 47 МЛН
The standard library now has all you need for advanced routing in Go.
13:52
How to connect Remix to Github
8:24
yuki
Рет қаралды 95
Remix Single: Concurrent Mutations w/ useFetcher
15:06
Remix
Рет қаралды 33 М.
This reminded myself of why I dislike Next.js
20:10
Web Dev Cody
Рет қаралды 52 М.
Turns out REST APIs weren't the answer (and that's OK!)
10:38
Dylan Beattie
Рет қаралды 151 М.
Optimistic UI in Remix
38:02
Sam Selikoff
Рет қаралды 9 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 172 М.
A Better Way To Organize Components In Vue
10:10
Program With Erik
Рет қаралды 20 М.
ISSEI & yellow girl 💛
00:33
ISSEI / いっせい
Рет қаралды 25 МЛН