React Most Asked Interview Question pt1 😎

Get my Interview notes - frontendsecrets.com/
This video contains the Most asked Reactjs Interview Questions.
Join Whatsapp group - chat.whatsapp.com/HBL7LxD1dfc...
Subscribe for more upcoming Interview Questions.
LIKE | SUBSCRIBE AND SHARE
ADD ME ON :
Instagram - / akash_sandip
LinkedIn - / sandipguchait

Пікірлер: 563

  • @coder0015
    @coder00152 жыл бұрын

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

  • @rafinha0206

    @rafinha0206

    2 жыл бұрын

    @MARCVS ANTONIVS chill bro

  • @coder0015

    @coder0015

    2 жыл бұрын

    @MARCVS ANTONIVS I've just started learning React. That's why!

  • @harishramakrishnayatham7210

    @harishramakrishnayatham7210

    Ай бұрын

    how is it going bro now

  • @hasanalshareef5047
    @hasanalshareef50472 ай бұрын

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

  • @chiragsingla.

    @chiragsingla.

    29 күн бұрын

    bad practice to pass data from child to parents in most cases. In this example imagine how much effort would have been saved if he did it in one component

  • @user-qi7th9vk2k

    @user-qi7th9vk2k

    28 күн бұрын

    ​@@chiragsingla.ahahahha. One file with 10000+ lines?) Joke, but decomposition matter

  • @chiragsingla.

    @chiragsingla.

    28 күн бұрын

    I would have made a component called Rectangle or Box which takes color name as prop. This is the right way to do this lol imo

  • @chiragsingla.

    @chiragsingla.

    28 күн бұрын

    @@user-qi7th9vk2k This was not good example of decomposition.

  • @chiragsingla.

    @chiragsingla.

    28 күн бұрын

    @@user-qi7th9vk2k Imagine using 2 useState hooks for doing this

  • @assuraworkwalker9640
    @assuraworkwalker96402 ай бұрын

    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 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.

  • @henriquecabralferraz4632

    @henriquecabralferraz4632

    Ай бұрын

    He is naming it as Callback to explicitelly pass the idea in the video, but I do not underestimate a newby to actually think this is a great name kkk

  • @CDob

    @CDob

    Ай бұрын

    May I ask who do you recruit for, and if you are currently recruiting? Thanks!

  • @ilovepizza8263

    @ilovepizza8263

    10 күн бұрын

    if someone is watching this youtube video then you can assume they know what a child component is and could tell the callback.js was the child component

  • @ambupadamuduli3794
    @ambupadamuduli37942 жыл бұрын

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

  • @heysandip

    @heysandip

    2 жыл бұрын

    Sure!

  • @tt4m

    @tt4m

    Жыл бұрын

    Why

  • @MVSBAND
    @MVSBAND Жыл бұрын

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

  • @cookieman.19

    @cookieman.19

    9 ай бұрын

    Was it the most efficient solution, any drawbacks?

  • @ValeriaTiourina

    @ValeriaTiourina

    2 ай бұрын

    Yeah, this is what I would have done!

  • @oovoo1995

    @oovoo1995

    2 ай бұрын

    yup, why making another function to just to set lol

  • @juggles5474

    @juggles5474

    Ай бұрын

    yeah why do we need to complicate it more than that?

  • @gustavogomez2570

    @gustavogomez2570

    24 күн бұрын

    Agreed, no need to wrap the set state function. Just pass it directly to the child in the props.

  • @cognitivebubble4272
    @cognitivebubble42722 жыл бұрын

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

  • @heysandip

    @heysandip

    2 жыл бұрын

    Thanks for the constant support!

  • @hajimeippo804
    @hajimeippo8042 жыл бұрын

    This is the kind of shorts I want to see! Thanks for the tip sir! Susbscribed :)

  • @faangbang9361
    @faangbang93612 жыл бұрын

    Thanks alot, your video popped up at right time 💖

  • @surendrareddyseelam9757
    @surendrareddyseelam97572 жыл бұрын

    Subscribed!! Keep sharing your good work brother

  • @heysandip

    @heysandip

    2 жыл бұрын

    Thanks for the support! Much Love

  • @kishordure505
    @kishordure5052 жыл бұрын

    Thank you Sandip for the video 🙏

  • @heysandip

    @heysandip

    2 жыл бұрын

    Hopefully it helps!

  • @tt4m

    @tt4m

    Жыл бұрын

    ♥️♥️

  • @pradyotsinha1959

    @pradyotsinha1959

    Жыл бұрын

    @@heysandip which code editor are u using

  • @fullmetaltheorist
    @fullmetaltheorist3 ай бұрын

    Sinple yet effective. You are smart.

  • @benstov2
    @benstov22 ай бұрын

    A get function that calls a set function is not a good practice

  • @proletar-ian

    @proletar-ian

    2 ай бұрын

    It's not that bad as long as the children aren't getting state setters passed directly and they aren't causing feedback loops. Passing callbacks to children allows for the state logic to remain in the parent component in this example.

  • @seeking9145
    @seeking91452 ай бұрын

    I really needed that in past. Very good explained! I had hard times to understand how to manage that 😂

  • @thuaneptrai9727
    @thuaneptrai9727 Жыл бұрын

    you are doing the things that very useful. keep going bro

  • @prafulcharde2871
    @prafulcharde28712 жыл бұрын

    Well well well well done !!!👏👏👏

  • @evanserickson
    @evanserickson Жыл бұрын

    Excellent video. Keep in mind this one works when passing functions. You can’t pass objects and then update the object

  • @saxtonvasquez9519
    @saxtonvasquez95196 ай бұрын

    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

  • @mannumannu9200

    @mannumannu9200

    4 ай бұрын

    Don't you know, local variables are always preferred over global variables. Context API provide global state which will stop you to make your project scalable, more problems in debugging & testing.

  • @ak2s

    @ak2s

    3 ай бұрын

    ​@@mannumannu9200 As OP mentioned, context isn't inherently global. You only have access to it in child components. That being said, in this scenario prob makes sense to use a callback or pass the setter function. Using context is like killing a spider with a hammer

  • @sohigh7433

    @sohigh7433

    3 ай бұрын

    ​@@mannumannu9200 if the component isn't within the context provider's scope, it won't have access to the context.

  • @user-vt4eh1os3m

    @user-vt4eh1os3m

    3 ай бұрын

    False, although a way, for such a simple example, you wouldn't need context.

  • @jasonnares9634

    @jasonnares9634

    Ай бұрын

    Idk why but I'm not really a fan of context API

  • @bluehawkfire55
    @bluehawkfire55 Жыл бұрын

    Thank you and to the comments. I needed this info :)

  • @swarajgadre5630
    @swarajgadre5630 Жыл бұрын

    I guess we can also use context API for big stack project

  • @midophriya3657

    @midophriya3657

    Жыл бұрын

    Straight redux when things became nested

  • @frogGames

    @frogGames

    Жыл бұрын

    @@midophriya3657 redux toolkit is much simpler than context api now

  • @floskater99

    @floskater99

    2 ай бұрын

    @@frogGames what about zustand?

  • @jasonnares9634

    @jasonnares9634

    Ай бұрын

    Using context API for a big project is not scalable. And its hard to maintain. Im talking by experience. :( I once encountered a page with 20 context providers. Uses context for almost everything even for a drawer and modal state. 😭

  • @salmanhafizh7513
    @salmanhafizh75134 күн бұрын

    this was something that i was thinking abt

  • @randolphcarter8283
    @randolphcarter8283 Жыл бұрын

    Hi sir, interesting, i like your style to explain with your hands, feel like classroom with teacher exolaining in the blackboard, regards!

  • @lautarolesniewicz2884
    @lautarolesniewicz2884 Жыл бұрын

    Nice well explained, good job mate

  • @allinone_747
    @allinone_7477 ай бұрын

    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??

  • @imuhammadessa
    @imuhammadessa3 ай бұрын

    Super amazing short 🎉

  • @newtypetommy
    @newtypetommy Жыл бұрын

    very important concept! thank you for sharing. please make a video about the importance of binding a function before passing it as a prop!

  • @saivaraprasad9989
    @saivaraprasad9989 Жыл бұрын

    Super ga cheppav Bro 👌👌

  • @muhammadhashim4105
    @muhammadhashim41052 ай бұрын

    In simple words it is not call back it props

  • @AbhishekKumar-vl3cb
    @AbhishekKumar-vl3cb2 жыл бұрын

    Awesome work 👍keep uploading...

  • @heysandip

    @heysandip

    2 жыл бұрын

    I hope its useful as refresher!

  • @AbhishekKumar-vl3cb

    @AbhishekKumar-vl3cb

    2 жыл бұрын

    @@heysandipthese are quick refresher👍🥭

  • @travelspurs
    @travelspurs6 ай бұрын

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

  • @Julukevin
    @Julukevin3 ай бұрын

    Wow brother this is amazing

  • @sarthaknikhal5540
    @sarthaknikhal55402 жыл бұрын

    More videos like this ✨

  • @withanujmittal2800
    @withanujmittal2800 Жыл бұрын

    I know this but I like your video for motivating you to make this type of content

  • @typingforall
    @typingforall Жыл бұрын

    🗝️ boarding is a great skill, keep it up 👍

  • @altintasutku
    @altintasutku2 ай бұрын

    Bro if you pass a function to a child just pass the setter function

  • @proletar-ian

    @proletar-ian

    2 ай бұрын

    No no no haha. That's tightly coupled code. Children shouldn't have direct access to state setters.

  • @altintasutku

    @altintasutku

    2 ай бұрын

    Because of what. In this case we are already giving them full access so what's the purpose

  • @nidhishpareek

    @nidhishpareek

    Ай бұрын

    ​@@proletar-ian the function would get recreated again and again, reference would change and again and again rendering would happen for child.

  • @mindbodyps
    @mindbodyps Жыл бұрын

    Question should be how you will send data from child to parents without shifting the state from child to parents and the answer is there are multiple ways. 1. You can create a global state for which you can use redux toolkit, or redux by creating a slice and declaration a global state there and in whatever compound you want to use it you can use useSelector to select the state and useDispatch to dispatch the changes to global state created inside the slice

  • @xiongbenjamin
    @xiongbenjamin Жыл бұрын

    Well explained Ty!

  • @codingwithkrpajay
    @codingwithkrpajay Жыл бұрын

    Helpful, Thanks!

  • @blockchaindevelopment120
    @blockchaindevelopment120 Жыл бұрын

    Great Sir!Can you please tell me which font style and theme are you using in vs code?

  • @vikasrai4584
    @vikasrai4584 Жыл бұрын

    Good explanation 👏 can u also specify the font you have used 😄 it's really cool ..

  • @dark2520
    @dark2520 Жыл бұрын

    My only issue with this is that now instead of using one function to control a component. You have to use 3. The useState on the parent, child, and the callback. I’m not sure if that’s efficient which much larger apps

  • @ujwal_mahindrakar
    @ujwal_mahindrakar2 жыл бұрын

    Would love to see something like this on angular

  • @desoga

    @desoga

    Жыл бұрын

    We have the input and output decorator.

  • @ujwal_mahindrakar

    @ujwal_mahindrakar

    Жыл бұрын

    @@desoga that's true, what i actually ment was tips and tricks vides on Angular

  • @davonnev696
    @davonnev6966 ай бұрын

    thank you, just did this !

  • @DEEPAKKUMAR-jt9iv
    @DEEPAKKUMAR-jt9iv2 жыл бұрын

    Best example in internet of pass data from child to parent

  • @joshk2181
    @joshk21812 жыл бұрын

    Pretty good explanation

  • @heysandip

    @heysandip

    2 жыл бұрын

    Thanks!

  • @proloybhaduri.official
    @proloybhaduri.official Жыл бұрын

    If someone understands useState hook properly, that is more than sufficient to explain . Don't confuse or get confused .

  • @jayeetaaich7746
    @jayeetaaich77462 жыл бұрын

    Nice! All the best!

  • @heysandip

    @heysandip

    2 жыл бұрын

    Thanks

  • @turolretar
    @turolretar Жыл бұрын

    It’s advised to not pass state from children, control it on the parent

  • @shanerichter6402
    @shanerichter6402 Жыл бұрын

    Thank you! Would setColor be a better name for the callback or no?

  • @mitchelline

    @mitchelline

    5 ай бұрын

    Yes it would be

  • @aniketnshukla
    @aniketnshukla2 жыл бұрын

    Thankyou so much!!!!

  • @Shvmrooz
    @Shvmrooz5 ай бұрын

    Props bro!

  • @archlinux8390
    @archlinux83902 жыл бұрын

    What about lifting state up

  • @CodingBirdsOnline
    @CodingBirdsOnline Жыл бұрын

    Your vscode theme looks great, can you which one it is?

  • @thecoolnewsguy

    @thecoolnewsguy

    8 ай бұрын

    Ok so I use a similar one called one dark darker

  • @kumarvs66
    @kumarvs6621 күн бұрын

    Informational !

  • @ladicbila9274
    @ladicbila9274 Жыл бұрын

    Do you have, a crash course off react js for beingger to pro??

  • @kapilrana3610
    @kapilrana36103 ай бұрын

    bhai ek react js ki series bnao jisme react ko real world project ke bases pr bato

  • @RAHULYADAV-rw4xj
    @RAHULYADAV-rw4xj Жыл бұрын

    Great brother please make a full video on this type of questions helps a lot thanks 🙌😍

  • @avijitsaha8107
    @avijitsaha8107 Жыл бұрын

    Nice example. 😍

  • @JRGPARAMO
    @JRGPARAMO2 жыл бұрын

    What font and color theme is that?

  • @maycodes
    @maycodes10 ай бұрын

    Make more videos on react

  • @deepdas7674
    @deepdas76743 ай бұрын

    In my opinion lifting the state up is one of the most easy thing in this scenario,

  • @nayanjaiswal
    @nayanjaiswal Жыл бұрын

    Amazing bro

  • @mbonisimtunzi
    @mbonisimtunzi Жыл бұрын

    This is awesome

  • @parthdz8410
    @parthdz84109 ай бұрын

    What’s your VS Code font family and Color theme?

  • @kunaljoshi8038
    @kunaljoshi80382 жыл бұрын

    We could wrap the callback passed as prop in useCallback and then wrap the child component in memo to avoid unnecessary re renders of the child component. If I am not mistaken that is. Thanks for the video

  • @emilenev586
    @emilenev586 Жыл бұрын

    There is something called Lifting State Up. Read react documentation before make this kind of tutorials

  • @Harshkr8
    @Harshkr85 ай бұрын

    Bro what about Namaste Frontend System Design

  • @walterdiaz2003
    @walterdiaz20033 ай бұрын

    An excellent video.

  • @marveken
    @marveken Жыл бұрын

    Please how many interviews questions do they get to ask you? Also please share all… too

  • @pickup-tech5273
    @pickup-tech5273 Жыл бұрын

    yes its inmportant :)

  • @nareshvasuja3506
    @nareshvasuja35068 ай бұрын

    Bro how is you macbook's screen matte? What cover /thing have you used?

  • @kunalshokeen4357
    @kunalshokeen4357 Жыл бұрын

    For sending state from child to parent we can use state uplifting or context hook.

  • @jugalkumarseth7675
    @jugalkumarseth7675 Жыл бұрын

    Don't get demotivated by comments dude everyone does mistake. Cheers

  • @rituvishwakarma5613
    @rituvishwakarma56135 ай бұрын

    👏👏thanka a lot

  • @ceejayviii
    @ceejayviii3 ай бұрын

    🔥🚀🇿🇦Dankie

  • @egosumcamax
    @egosumcamax2 жыл бұрын

    Thank!

  • @prashantparmar2217
    @prashantparmar22172 жыл бұрын

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

  • @Techie_Sridhar
    @Techie_Sridhar3 ай бұрын

    You should follow a single source of truth for the react state. You can use only the UIcolor state alone instead of 2.

  • @himanshuagarwal2712
    @himanshuagarwal27125 күн бұрын

    We can send function as a prop from child to parent And parent will call the prop function and access the data in function

  • @ikevin127
    @ikevin1278 ай бұрын

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

  • @kevinturpin2273
    @kevinturpin227325 күн бұрын

    3 ways : callback as you said, provider with a context or using redux

  • @TheLifeofNerd
    @TheLifeofNerd10 ай бұрын

    At what point does the use of context become more efficient? I figured “prop drilling” would be the main factor regarding that decision, but don’t know of any others.

  • @prashanthvadde4981
    @prashanthvadde4981 Жыл бұрын

    what is the theme you used?

  • @dhawalparmar7117
    @dhawalparmar7117 Жыл бұрын

    Parent to child : props Child to parent : maybe callback or redux

  • @kishoreramana1
    @kishoreramana16 ай бұрын

    I have used it to pass grid data to parent component

  • @cpasneedles
    @cpasneedles Жыл бұрын

    or just use onChange={function callback} on your input and in your function write what do you want to do

  • @riajikbal2938
    @riajikbal29384 ай бұрын

    Thanks bhai 🎉

  • @FilipeLeonardoM
    @FilipeLeonardoM2 жыл бұрын

    Nice! Or useContext 👍

  • @freelancerweb813
    @freelancerweb8132 жыл бұрын

    What's name of the themes ?

  • @teknologene
    @teknologene Жыл бұрын

    To put it simply. Callbacks are function props that gets executed and has an effect in the parent component.

  • @kamalsharma2839

    @kamalsharma2839

    Жыл бұрын

    Is he passing data from child to parent? I can see data being passed from parent to child, as the other way round is not possible at all with prop drilling, if I am right.

  • @luisg.sandoval2046
    @luisg.sandoval2046 Жыл бұрын

    excelent video

  • @michaelchen8910
    @michaelchen89102 ай бұрын

    In the spirit of wording things, I think here the idea of passing data up from child -> parent isn't the way to think of things in React. Instead its more like the "child can tell the parent about something that happens". In this case, the child is telling the parent that color has changed. I think a very common question that most beginner React developers have is "How do I access the data in my child?" Which is generally answered with "you dont". Instead you own the data, and give it to the child. And u may have to move shit around to achieve that.

  • @nathanmedo
    @nathanmedo4 ай бұрын

    I like this method but what I do is use the useState directly on the background of the div so no roundabout way in it👍

  • @tulikinikini4321
    @tulikinikini4321 Жыл бұрын

    Hate passing single functions though. It’s much better to pass an object with methods and properties once and manage state in parent

  • @umardarazofficials3529
    @umardarazofficials35292 ай бұрын

    New sub's is here

  • @mohammadrafi895
    @mohammadrafi895Ай бұрын

    What is the VS code theme you're using?

  • @user-vt4eh1os3m
    @user-vt4eh1os3m3 ай бұрын

    If you want, you can avoid the useState all together in the child component and just pass the data back directly.

  • @EazyE206
    @EazyE2066 ай бұрын

    You just got a subscribe from me my man

  • @rehkmansa
    @rehkmansa Жыл бұрын

    But you can still create Callback as a pure function component and have the value passed and the onchange too No need to declare extra lines of codes

  • @kaioneal6160
    @kaioneal616019 күн бұрын

    It’s cool to know how something works but do you know why it works the way it does? Understanding how the ‘this’ context works in component is crucial to understanding JavaScript and react as a whole.

  • @anuj12327
    @anuj12327Ай бұрын

    In this method you are using more space by using two usestate() you can just use props to the child and use it in parent