DEV Community

Cover image for My collection of React Interview questions (Part 1)

My collection of React Interview questions (Part 1)

Miguel Ruiz on September 03, 2018

Part 1 Part 2 Part 3 +10 interview questions in react straight from my vault Starting with the most typical questions to some that will ...
Collapse
 
themindfuldev profile image
Tiago Romero Garcia • Edited

Excellent list, great job @migueloop !

Just to mention something that recently changed: in React 16.3.0, some lifecycle methods have been deprecated:

  • componentWillMount()
  • componentWillReceiveProps()
  • componentWillUpdate()

They still can be used for now, but you would need to prefix it with UNSAFE_, like UNSAFE_componentWillMount, UNSAFE_componentWillReceiveProps, and UNSAFE_componentWillUpdate.

These are expected to be removed on React 17.

We got then some new methods to compensate for that:

  • getDerivedStateFromProps(props, state) - Called after a component is instantiated as well as before it is re-rendered. It can return an object to update state, or null to indicate that the new props do not require any state updates.
  • getSnapshotBeforeUpdate(prevProps, prevState) - Called right before mutations are made (e.g. before the DOM is updated). The return value for this lifecycle will be passed as the third parameter to componentDidUpdate. (This lifecycle isn’t often needed, but can be useful in cases like manually preserving scroll position during rerenders.)

Source (with examples): Update on Async Rendering.

Collapse
 
migueloop profile image
Miguel Ruiz

That's true Tiago. When I first did my list we had an older version of React. I will update it asap. Thanks so much

Collapse
 
themindfuldev profile image
Tiago Romero Garcia

You are welcome, Miguel!

And totally, these things change so fast these days!

Thread Thread
 
migueloop profile image
Miguel Ruiz

Updated Tiago! Thanks a lot

Collapse
 
ruslanchek profile image
Ruslan • Edited

I would add that questions:

  1. What is HOC?
  2. What is FC?
  3. The lifecycle of FC's and the difference against class components?
  4. What are hooks and how to?
  5. Shared state management how to implement?
  6. Render time. What happened under the hood?
  7. Fibers - how it works?
  8. Async rendering.
  9. Reusable components.
  10. Best practices.
  11. Flux.
  12. Performance.
  13. Styling methods (styled, Emotion, CSS modules etc)
Collapse
 
migueloop profile image
Miguel Ruiz

Thanks a lot for your message Ruslan. I will definitely extend the guide considering your points

Collapse
 
aershov24 profile image
Alex 👨🏼‍💻FullStack.Cafe

Thanks for the great post Miguel! Your QAs have been added to the fullstack.cafe portal and back-linked to that article!