React JS Interview Questions ( OTP Login ) - Frontend Machine Coding Interview Experience

  Рет қаралды 122,302

RoadsideCoder

RoadsideCoder

Күн бұрын

🔴 Get my Complete Frontend Interview Prep course - roadsidecoder....
➡️ Book an Interview Preparation call with me ( 20% OFF for limited time ) - topmate.io/roa...
🟪 Follow me on Instagram and u will clear your interview 🤓 - / roadsidecoder
React Interview Question on implementing a OTP login with Phone Number feature will be created in this video along with tips and tricks to tackle your React JS and JavaScript Questions in Frontend Machine Coding Interviews.
👤 Join the RoadsideCoder Community Discord -
/ discord
🔗 React JS Interview Series -
• Frontend Machine Codin...
➡️ Source Code -
github.com/piy...
🔗 Strings Video -
• Strings - Data Structu...
🔗 Complete Data Structures and Algorithms with JS Course - • Data Structures and Al...
🔗 JS Interview Series -
• Javascript Interview Q...
🔗 Cars24 Interview Experience -
• Frontend Interview Exp...
🔗 Unacademy Interview Experience -
• Frontend Interview Exp...
🔗 Tazorpay Interview Experience -
• Frontend Interview Exp...
🔗 MERN Stack Tutorial with Redux -
• MERN Stack Project Tut...
🔗 React Beginner's Project Tutorials -
• React JS Project Tutor...
#JavascriptInterview #ReactInterview #ReactJS
-------------------------------------------------------------------------
00:00 Intro
01:05 Setup New React App
03:12 Phone Login Component
10:42 OTP Input Component
16:08 Styling OTP Inputs
16:57 OTP Field focus after First Render
19:29 Updating OTP Field Logic
25:26 Move to Next Field after Input
27:08 Move to Previous Field on Backspace
29:08 Move Cursor to Last on Click
31:00 Adding More Validations
33:11 Homework for you
33:52 Secret Announcement
-------------------------------------------------------------------------
⭐ Support the channel -
/ @roadsidecoder
Special Thanks to our members -

Пікірлер
@RoadsideCoder
@RoadsideCoder Жыл бұрын
🔴 Get my Complete Frontend Interview Prep course - roadsidecoder.com/course-details ➡ Book an Interview Preparation call with me ( 20% OFF for limited time ) - topmate.io/roadsidecoder 🟪 Follow me on Instagram and u will clear your interview 🤓 - instagram.com/roadsidecoder/
@rishiraj2548
@rishiraj2548 Жыл бұрын
👍
@mdiftekhar0000
@mdiftekhar0000 Жыл бұрын
valid
@_sarthakmisal
@_sarthakmisal Жыл бұрын
Bhai paise nahi hain
@hamzaseif4992
@hamzaseif4992 Жыл бұрын
Me : there is no way i will get asked these tricky js questions in my interview but lets watch roadsidecoder js interview questions anyway, 95% of the questions were from your videos lol , thanks a lot
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Hahah, Thanks a lot!
@manojinderparmar2277
@manojinderparmar2277 11 ай бұрын
Thank you so much for creating such a usable OTP component. I have implemented it in my project after learning it from you.
@amitavasengupta5580
@amitavasengupta5580 7 ай бұрын
I had my machine coding round yesterday and the interviewer asked me to code this otp functionality. He was super impressed and I got selected in the technical round, next is hr round. Thanks dude for making this awesome content. Wish I had even 50% of the knowledge you have then I would be a superhero like you
@RoadsideCoder
@RoadsideCoder 7 ай бұрын
Amazing bro! Congrats.
@iniyaninba489
@iniyaninba489 6 ай бұрын
@@RoadsideCoder Bro I have a doubt, in this video, at 4:00 , You just clicked on PhoneOtpForm, and then it got imported in the code, how can we do it bro, which extension bro?
@rocs11
@rocs11 Жыл бұрын
Awesome tutorial! I'm new to React and I followed along in Typescript and had no problems. Very good explanation of why you use particular methods/patterns in certain situations! btw, you jump scared me with the Instagram sponsor 🤣
@H_NileshKumar
@H_NileshKumar Жыл бұрын
Is it necessary or important to shift to typescript in react?
@rocs11
@rocs11 Жыл бұрын
@H_NileshKumar Neither TypeScript nor JavaScript is strictly better for React development in all cases. But it has its advantages, like type safety and better IDE support (autocompletion, etc.). So, for more complex projects, I will use Typescript, and for fast prototyping, I'll go with Javascript. But again, it's also a preference.
@H_NileshKumar
@H_NileshKumar Жыл бұрын
@@rocs11 I see , well I just found that I suck at logic building. Maybe bcoz I haven't done many projects with simple js ,so I'm doing that rn
@TooJoo77
@TooJoo77 Жыл бұрын
HomeWork answer : const value = e.target.value; if (value && idx < length - 1 && inputRefs.current[idx + 1]) { inputRefs.current[OTP.indexOf("")].focus(); }
@theofficialleaker2495
@theofficialleaker2495 Жыл бұрын
its too long bro just do if (index >= 0) { inputref.current[otp.indexOf("")].focus(); }
@guptasagar694
@guptasagar694 11 ай бұрын
@@theofficialleaker2495 Kaha se chalega ye, Question kya he aur tu bata kya raha he, agar kisi input field jo empty ho uspe directly jana he
@ManoharBatra
@ManoharBatra Жыл бұрын
best video on machine coding, you covered many things in one video.. kudos... let's collab again because my audience is waiting :)
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Thank u so much bhai 🥹
@rayyanabdulwajid7681
@rayyanabdulwajid7681 Жыл бұрын
Yea, it was an excellent video
@web_dev_with_ak
@web_dev_with_ak Жыл бұрын
Very very very useful video for frontend developers. Thank you for giving the knowledge 👌👌👌👌
@mdiftekhar0000
@mdiftekhar0000 Жыл бұрын
yeah you're right dude
@VikasKumarSingh-m4h
@VikasKumarSingh-m4h Ай бұрын
AWESOME LEARNT A LOT
@omrajgure4553
@omrajgure4553 Жыл бұрын
Hey you are awesome 🙌….your channel is so underrated 😢…..thanks for this great content and try making a playlist of you developing complex only react projects ❤…..you gained a sub 🎉
@griffinannshual4205
@griffinannshual4205 Жыл бұрын
Great video brother, learned a lot!
@aqibmalik6313
@aqibmalik6313 Жыл бұрын
this has many bugs click backspace on 3 field gives error backspace does not remove the value in first field
@LENDUONG-er3zq
@LENDUONG-er3zq 8 ай бұрын
hay quá anh zaii oiiii
@AbhishekKumar-td5zu
@AbhishekKumar-td5zu 2 ай бұрын
great job !!
@eehan1769
@eehan1769 6 ай бұрын
i had to watch twice to keep up but amazing content!!
@kiva1806
@kiva1806 Жыл бұрын
Outstanding very useful video & doing a great job bro🤓🤓🤓
@goshmain982
@goshmain982 Жыл бұрын
this is practical example of real world enterprise grade production ready tutorial thank you so much
@RoadsideCoder
@RoadsideCoder Жыл бұрын
You're welcome!
@ChauhanJiVlogs007
@ChauhanJiVlogs007 Жыл бұрын
Great video... Brother...🎉🎉🎉🎉
@nikitarawat953
@nikitarawat953 11 ай бұрын
onKeyDown event is not working as expected. when i click backspace, the cursor still remains on the same input and when i again click backspace it goes to the previous input and automatically delete that otp. Instead, onKeyUp works perfectly fine in my code. why this happening?
@nishanbangera9349
@nishanbangera9349 11 ай бұрын
I am facing the same problem...have u rectified the reason for that bug?? If yes please tell me
@AllAboutIelts24by7
@AllAboutIelts24by7 Ай бұрын
hi, it is happening because of the default behavior of backspace which is removing the character from input box. It can be resolve just by using this statement event.preventDeafult(); in the block where we are writing specific code for backspace.
@suchithkumargm
@suchithkumargm 7 ай бұрын
amazing video....very clear explanation
@xdotaku5182
@xdotaku5182 11 ай бұрын
I didn't try it, so correct me if I am wrong. If we are using "tab" button to move b/w components, the "onClick" won''t trigger. So maybe we should run the cursor positioning function on "onFocus"?
@debaprasadbehura968
@debaprasadbehura968 8 ай бұрын
bhai esa laga ki jaise tune ye sab kahan se rata mar ke ayae tha baise likh diya jo kar raha hai samjahana cahiye tha na bas likhe ja raha hai yar btw good content or code already present in geeks for geeks
@RoadsideCoder
@RoadsideCoder 8 ай бұрын
bhai iss video ko follow karne se pehle apko react js aani zruri hai, else u wont understand the code.
@ffgameing8936
@ffgameing8936 8 ай бұрын
​@@RoadsideCoderBhai react padha hun main Mujhe app PE koi doubt nehi Hain bus ya bol Raha ti app ne pura geeks for geeks copy kar diya Apne kuch neya nehi samjhaya isiliye bola ye Mera alag I'd hai But thanks to this video It helps me know a lot of things ❤❤❤❤❤
@Aviralsingh-yw7xx
@Aviralsingh-yw7xx Жыл бұрын
Thanks a Lot Sir.
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Welcome!
@anusmitakundu2366
@anusmitakundu2366 Жыл бұрын
This is so good. 💯
@subhadeepghosh2813
@subhadeepghosh2813 Жыл бұрын
U are really doing a great job bro
@besalraj4334
@besalraj4334 4 ай бұрын
Tweaked handleChange function to const handleChange = (index, e) => { const num = e.target.value; if(isNaN(num)) return; const newOtp = [...otp]; newOtp[index] = num.substring(num.length -1); setOtp(newOtp); const combinedOtp = newOtp.join(""); if(combinedOtp.length==length) { onOtpSubmit(combinedOtp); } // shift focus to next empty element const nextEmptyIndex = newOtp.indexOf(""); if(num && nextEmptyIndex!==-1 && inputRefs.current[nextEmptyIndex]) { inputRefs.current[nextEmptyIndex].focus(); } }
@kalideb-y3y
@kalideb-y3y Жыл бұрын
this is a smaller code to only focus first input element, put this on attribute "autoFocus={index == 0}" 🤓
@akshaylokray
@akshaylokray 11 ай бұрын
@RoadsideCoder how to build Aadhar input box where we have 3 input boxes that take 4 numbers each?
@subramanianchenniappan4059
@subramanianchenniappan4059 Жыл бұрын
Great . Thanks 😍😍.
@ArbazKhan-qm2vc
@ArbazKhan-qm2vc 5 ай бұрын
Not able to focus on the input when clicking on it
@prashanthgv86
@prashanthgv86 Жыл бұрын
Please create a video on Form Validations
@lucasaguiar7391
@lucasaguiar7391 4 ай бұрын
which browser do you use?
@RoadsideCoder
@RoadsideCoder 4 ай бұрын
firefox
@LatentIndia
@LatentIndia Жыл бұрын
sir please make video on portfolio website using react
@khomrajacharya6480
@khomrajacharya6480 Жыл бұрын
Please make a video on form validation
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Ok Soon!
@soumyadyutinandy5119
@soumyadyutinandy5119 Жыл бұрын
Just implemented wordle and it is very similar to this concept
@nileshsangle4946
@nileshsangle4946 11 ай бұрын
nice one sir
@arpankumar4176
@arpankumar4176 Жыл бұрын
make a video on form validation
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Definetely!
@theofficialleaker2495
@theofficialleaker2495 Жыл бұрын
Home work Answer ; do it inside onclick if (index >= 0) { inputref.current[otp.indexOf("")].focus(); }
@asadmehboob1300
@asadmehboob1300 Жыл бұрын
If we want to past 4 digits from email or phone no?
@dasarimanoj3086
@dasarimanoj3086 Жыл бұрын
When we gave the condition of phone number length to be < 10 then why is it allowing us to type random number more than 10? Shouldn't we throw an alert?🤔
@RoadsideCoder
@RoadsideCoder Жыл бұрын
we are saying lenght>10 not less, just as an example.
@ajaymalviya.7
@ajaymalviya.7 11 ай бұрын
The length should be exactly 10 and having only 0-9 in regex isn't correct validation, but that logic 000000000 will also be a valid number. Indian numbers start with 6-9 or 0 (044) in case of landline numbers.
@harvindersingh9170
@harvindersingh9170 7 ай бұрын
Why don't we just use a normal text input to place OTP?
@mateenmahi
@mateenmahi Ай бұрын
Coz it's user friendly
@_sarthakmisal
@_sarthakmisal Жыл бұрын
How is onOtpSubmit still working even after you declared it again with const
@arjunjadhav3062
@arjunjadhav3062 Жыл бұрын
i am trying to book your call but not happening actually money deduct ho gaya he do baar but call booked nahi huva.
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Please contact me on instagram @roadsidecoder with the screenshot
@PulkitMalhotra
@PulkitMalhotra 7 ай бұрын
Nice video but where is the verification logic part
@AshikRahman-fw3sv
@AshikRahman-fw3sv Жыл бұрын
WOW 😲😲😲
@pkam5690
@pkam5690 11 ай бұрын
Hey, that's my number..
@RoadsideCoder
@RoadsideCoder 11 ай бұрын
50 diffrerent people said that
@ultragamersvk1668
@ultragamersvk1668 Жыл бұрын
WHY DON'T YOU USE TAILWIND CSS?
@sandiss1210
@sandiss1210 Жыл бұрын
guys how can i get thier animated background
@srikarravoori124
@srikarravoori124 Жыл бұрын
I have got the downloaded file. Thanks
@DastageerHC
@DastageerHC Жыл бұрын
I was asked this question last month,
@murali-krishnan
@murali-krishnan 7 ай бұрын
Are you a fresher or have some experience? At what level does this question get asked?
@technicalrider6196
@technicalrider6196 Жыл бұрын
Continue this series
@jsagar95
@jsagar95 Жыл бұрын
Thanks!
@Lucifer-xt7un
@Lucifer-xt7un Жыл бұрын
Sir please bring a complete machine coding course please there are no one who are dealing this in complete market
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Releasing Soon. 🔥 Join here to be updated - discord.gg/2ecgDwx5EE
@Lucifer-xt7un
@Lucifer-xt7un Жыл бұрын
@@RoadsideCoder may i know any tentative time line for course launch pleasee
@RoadsideCoder
@RoadsideCoder Жыл бұрын
1st week of feb most probably
@Lucifer-xt7un
@Lucifer-xt7un Жыл бұрын
@@RoadsideCoder exciteddd🥳🤩🔥
@nisargbarot1998
@nisargbarot1998 Жыл бұрын
​Nnn@@RoadsideCoder
@captainjacksparrow8916
@captainjacksparrow8916 Жыл бұрын
Thank You sir jii
@gautamnangla2594
@gautamnangla2594 Жыл бұрын
Sir ye fresher interview question h kya experience
@RoadsideCoder
@RoadsideCoder Жыл бұрын
both
@gautamnangla2594
@gautamnangla2594 Жыл бұрын
@@RoadsideCoder sir web dev kr rakha h pr job nhi mil rahi h . Portals pr try krte h scam call aati h and paise maangte h .. . Kuch btaao sir first job kaise le IT sector m
@guptasagar694
@guptasagar694 11 ай бұрын
Nahi Mil paege..Kon si city me ho...Let me know, I will help@@gautamnangla2594
@gautamnangla2594
@gautamnangla2594 11 ай бұрын
@@guptasagar694 faridabad haryana
@_sarthakmisal
@_sarthakmisal Жыл бұрын
Bro theme kaunsi hai
@RoadsideCoder
@RoadsideCoder Жыл бұрын
peacock extension
@Gymaurcode
@Gymaurcode Жыл бұрын
Bro make videos on RTK query and redux toolkit
@_sarthakmisal
@_sarthakmisal Жыл бұрын
Bhai console close Kara Karo recording ke time
@goshmain982
@goshmain982 Жыл бұрын
love you
@samarscript5824
@samarscript5824 Жыл бұрын
33:49 Is there anyone here who has done the work I came specifically for?
@guptasagar694
@guptasagar694 11 ай бұрын
Yes Bro, if (value && inputRefs.current) { for (let i = index + 1; i < length; i++) { if (!inputRefs.current[i].value && inputRefs.current[i]) { inputRefs.current[i].focus(); break; } } }
@eehan1769
@eehan1769 6 ай бұрын
19:29
@stacked-dev
@stacked-dev Жыл бұрын
Brother don't wast time on building such UI from scratch you can use the thirld party libraires .
@RoadsideCoder
@RoadsideCoder Жыл бұрын
In interviews you wone be allowed to use third party packages
@AlgoIT__
@AlgoIT__ Жыл бұрын
Unnecessary give one input box y u need 4 I never understood
@RoadsideCoder
@RoadsideCoder Жыл бұрын
hahah, because this is the convention of an OTP Input
@guptasagar694
@guptasagar694 11 ай бұрын
To be honest, i foillowed this tutorail but the logics opf moving inside the OTP field, I didnot get any logic, Didnot understand a word...What to Do, Please help
@AshikRahman-fw3sv
@AshikRahman-fw3sv Жыл бұрын
💚💚💙💙💖😍😍
@Upsc2029-hy6ey
@Upsc2029-hy6ey Жыл бұрын
fun fact: mobile number will go viral.
@aakashyadav6228
@aakashyadav6228 Жыл бұрын
NGL, looked like you yourself were bit confused
@mattakalyan1427
@mattakalyan1427 Жыл бұрын
best video at final I tried with this logic inputRef.current[newOtp.indexOf("", index)].focus(); and it worked I just want to compare with your logic @roadsidecoader
@subhamrakshit7755
@subhamrakshit7755 6 ай бұрын
inputRef.current[newOtp.indexOf("")].focus()
Watch this before joining my Frontend Interview Prep Course 👀
9:19
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
3 Years Experienced React Interview
1:16:16
ProCodrr
Рет қаралды 134 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 919 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН