DEV Community

Cover image for React Interview - (Part 3)
Atul Bhatt
Atul Bhatt

Posted on • Edited on

React Interview - (Part 3)

So welcome🙂 again to another part of React Interview series. So we’re finally now into part-3. Before I thought to bind up this series into total of 3 parts but there are so many questions to cover because React also includes JS. So hopefully this series will have total 5 parts.

So let’s cut out the introductory crap and jump directly into some more React interview questions.

1- What does useState return?
2- What’s the difference between React Router and React router DOM?
3- What are peer dependencies?
4- Can we use React without JSX?
5- Why do we have to use className prop and can't have class as a prop to a component as a CSS selector?

  <div className= “react-interview”>
  Hi! [dev.to](http://dev.to) 
  </div>
Enter fullscreen mode Exit fullscreen mode

6- Explain the Redux lifecycle.
7- What’s the output?

     const b = 'abc' 
     b.push(d) 
     console.log(b)
Enter fullscreen mode Exit fullscreen mode

8- What are events in JS and how we can play around them?
9- Explain the use of useRef?
10- Difference between the Browser Router and Hash Router?

I'll be wrapping up this part of the article here. I'll be glad to read you answers to these question in the comment section.

And don't forget to mention your approach towards taking interviews. How you approach it? And I know there might be some flaws🥺 in asking these questions so you are free to point them out.

Top comments (1)

Collapse
 
thomas_reese_ab9861f5dc55 profile image
Thomas Reese
  1. What does useState return?
    useState is a React hook that returns an array with two elements:
    The current state value.
    A function to update the state.
    const [state, setState] = useState();

  2. What’s the difference between React Router and React Router DOM?
    React Router is the core library for routing in React. It provides the fundamental components and logic for creating navigational routes.
    React Router DOM is an extension of React Router specifically designed for web applications. It includes web-specific components like , , and .

  3. What are peer dependencies? Peer dependencies are dependencies that your project requires to work correctly but expects to be provided by the consuming project (the project where your code will run). They ensure that specific packages or versions are installed when multiple versions of a package could cause conflicts.

  4. Can we use React without JSX?
    Yes, you can use React without JSX. JSX is syntactic sugar for React.createElement.