Advanced React Ref Pattern

preview_player
Показать описание
How to expose functionality to parent components in React #react #reactjs #reactjsdeveloper #programming #progammer #frontend #devtok #coding #code #codetok #cs
Рекомендации по теме
Комментарии
Автор

A use case for this:

You have a VideoPlayer component. You can add ref and call the play() or pause() functions outside of the component.

deadchannel
Автор

and what does it do? a lot of your videos would benefit a lot, imho, if you show UI at the end with an example.

AsterixAstrix
Автор

I really like watching your videos, I learned something new again.
More power to you🎉

merlinmeraldz
Автор

Depends on the use case, but as much as possible i use context for everything aince it was introduce

fabre
Автор

Nice. You explain complex things in simplest manner 🎉

YogeshPatil-nwcn
Автор

i think the ref callback pattern is simpler and it would work for focus and clear as well

UserZZ-wn
Автор

Two questions. 1. Shouldn't you use forwardRef if you pass a ref to the child component? 2. It's great but the problem is that react discourages imperativeHandler because it's not optimal and only for extreme cases. Greetings

bobobo
Автор

I used this approach once i got a lot of issues with typing. It was a nightmare

meslzy
Автор

What I heard: “ ref ref ref ref ref ref ref ref ref ref “. Nonsense.

Daijyobanai
Автор

Shouldn’t we pass componentRef.current into useEffect dependencies list?

syonukr
Автор

What is the need of passing the parent ref inside useImperativeHandle, how do we use it?

prashantbharati
Автор

Shouldn't you forward the ref to the Component with React.forwardRef() ?

sourya
Автор

I imagine a mid level getting this code to update... what a confusing pattern, better stay away.

cloudsss
Автор

This is not recommend, please specify that.

gio_aguirre
Автор

Ничего не понятно, но очень интересно

bunyodl
visit shbcf.ru