Last month, I posted 2 ReactJS interview questions 🎤 - Advance Questions and Commonly Asked Question and got a significant welcome by dev.to community. 🤗 🥰 Many thanks to all of you!
I decided to complete the package by creating codepen exercises 📝 and a video 📺 to follow up on that effort as one will need to code following the technical interview questions. Also, I added potential solutions for the exercises which is listed below.
If you need to brush up 🆙 your ninja ReactJS skills, you can try to answer the exercises below OR click the video below to guide you step-by-step interactively. (No filler, fast, straight to the point as I highly respect/value your time)
These exercises and solutions will also be available on the video as well.
Exercises: 🏋️
Display simple JSX
Display array of users to browser
Show/Hide Element on Screen
2 way data binding in ReactJS
Disable a button
Update the parent state
Dynamically add child components (React Children)
Sum of Two Numbers
Create Counter App
Fetch data from an API
Solutions: 🙋
Display simple JSX
Display array of users to browser
Show/Hide Element on Screen
2 way data binding in ReactJS
Disable a button
Update the parent state
Dynamically add child components (React Children)
Sum of Two Numbers
Create Counter App 🕒
Fetch data from an API
Happy coding and good luck on your next interview! I hope this material will help you land your next dream job. 💰 🚗 📈
Latest comments (39)
It was fun! Thanks a lot!
Very helpful exercises for beginners. Thank you :)
hey bro please make more challeneges like these.. i want some hard level questions
too easy for interview, look real example
https://stackblitz.com/edit/stackblitz-starters-rqq4bw?description=A%20create-react-app%20project%20based%20on%20react%20and%20react-dom&file=src%2FApp.js,src%2Findex.js&title=React%20Starter
you can make that all works as expected, but wont pass interview because of interviewer wants you write some functions in other way
and you can forget some things because of worrying
I found this on udemy.
React JS Coding Interview Challenges and Exercises
udemy.com/course/react-js-coding-i...
its good.
I found these exercises are too easy. Could you please mention that these are for absolute beginners somewhere in the header of the post? I doubt that any interview question would be this straight forward. Nevertheless, appreciate your effort on making the post, it has to be useful for someone 👏🏻
That challenges too easy! Like for the junior level.
I would be glad to see more complecated challenges from you :)
sure. I can take it up a notch
Very helpful for me. Thank you.
of course. very welcome and happy to help
Nice I always look for those kind of challenges to practice
i plan on making more in the future. Stay tuned :)
Out of curiosity, if you could do all of these quite easily without any external help/docs, is that a good sign you might be ready for a React Junior Dev role? 🤔 Or would we need to be answering the advanced ones?
this is question is more tailored for experienced/advanced React Dev.
you can expect basic Q&A for React Junior Dev and small react exercises
think you i really enjoy the challenge
i am glad you feel that way
I enjoyed this! Thank you so much!!! If anyone have anything similar please share! I would love to tackle on some more!
Thank you in advance!
you are welcome!
For create counter app challenge, i created two functions (decrease and increase) to be passed instead, later simply calling ....is that inline with best practise?
it is and is common in any ReactJS applications
Great exercises! Had fun with these!!
One thing I want to note - in your solutions, I often see the pattern:
However, the React docs prefer this method of using the previous state value - passing a function that receives the previous state value.
Updating state with
value
instead of using the previous state function may result in some buggy behavior because of React's unpredictable & async state-updating logic. Likely won't see anything buggy with these examples since they aren't too complex, but just wanted to shout out that nuance!Thanks again for these great exercises!!
yes, passing a function is way better and the right approach to handle setting state here. Glad that you found this post useful and you are very welcome. Will create more post/video like again.
this is so helpful for interview prep, thank you!!
helping engineers like you and me are the goal of this post and video.
I appreciate the comment and stay tuned for more post like this.