@ikevin127

better ways:
- lift state up (parent only) and pass through props
- wrap children with forwardRef, and controll it from parent

@coder0015

As a dev (who's in love with React), I need more of these shorts!!

@hasanalshareef5047

1- i use  function call   On parent  calling  expect props by children 
2- use Context
3- redux

@travelspurs

It's so tough. C++ Java were easy back in our times!

@assuraworkwalker9640

I think that calling this child component Callback is not the best Idea, evenmore in an interview context. Because Callback is a concept and components should not be named as concepts. The sub component that takes a function as a prop could be named as <ColorNameInput updateColor={updateColor} /> in my opinion this is more obvious than Callback... As a recruiter I will also expect from candidate to be conscious of the naming aspect because this is often a negliged aspect. Of course you're right this question of props drilling up and down is important. :)  My coment is only my opinion.

@MVSBAND

Another solution is just passing the setUIcolor into child and set the color in handleChange… :)

@Sultan-t1c

instead getColor, it should be setColor because you are setting and not getting.

@mahmudrashid492

why don't we use state lifting ??

we can create a function on the parent component to do all the stuff and pass it to the child component , and just use that in onChange event in the input

@sshmyg

Make component controlled or uncontrolled, don’t mix it. And you will thank you to yourself in the future.

@ambupadamuduli3794

Thanks Sandip. It's really helpful . Want more shorts like this

@RichHacksYT

Wow. So I just did that yesterday without knowing. It felt so normal and easy for me

@RaviGILL-s1f

That’s masterpiece, never thought about it . Thanks sir ❤

@cognitivebubble4272

Wish you more of strength! For making react Interviewee's life easier

@saxtonvasquez9519

Context is the best thing to use for react state management. You would set the state in a provider file which will be used as a component to wrap your entire project (or everything it’s relevant to) and then you import what you need into the child components including values and functions

@ctrain149

I fucking wish they asked me questions as easy as this

@fullmetaltheorist

Sinple yet effective. You are smart.

@allinone_747

You can directly use useRef in parent and send it to child through prop....and use ref in input box....you will get current value of box through ref in parent ryt??

@prashantparmar2217

Its not a callback function. You can refer it as a pointer at a function with arguments to be passed into

@kishordure505

Thank you Sandip for the video 🙏

@ranieldenicen.marpuri6544

i love components. and i do this all the time, great now I know what its called thanks !