Top React Interview Questions!-1
Top React Interview Questions!-1
js
INTERVIEW QUESTIONS
~ Artem
1-18 ~ -: ~ @like_a_senior
1. What is React.js?
React.js is an open-source JavaScript library developed by
Facebook (Meta) for building user interfaces or Ul
components. It allows developers to create reusable Ul
components and efficiently manage the state of an
application.
~ Artem
~ : ~ @like_a_senior
3. What is a component in React?
A component in React is a reusable and self-contained piece
of UI that can be composed together to build complex user
interfaces. Components can have their own state, properties
(props), and lifecycle methods.
'-"- Artem
~ : "'! @like_a_senior
5. Explain Controlled Form Components.
In HTML, form elements such as <input>, <textarea>, and
<select> typically maintain their own state and update it
based on user input. In React, mutable state is typically kept
in the state property of components, and only updated with
setState().
'-"- Artem
~ : ~ @like_a_senior
*
8. Can we use Typescript, how?
Yes, we can use TypeScript with React. The most common
way is to set up React using typescript template.
'-'- Artem
~ : ~ @like_a_senior
10. How to start a new React project?
React recommends to use one of the React-powered
frameworks:
• Next.js
• Remix
• Gatsby
We also can use Vite to start a new React project or Create
React App
'-'- Artem
~ : ~ @like_a_senior
12. What are React Fragments, and
why are they used?
React Fragments are a way to group multiple elements
without adding extra nodes to the DOM. Th ey are often used
when you need to return multiple elements from a
component's render method, as JSX typically requires a
single parent element.
,,... Artem
~ : ~ @like_a_senior
14. Explain React Data Binding.
React enforces a unidirectional data flow, where data flows
in a single direction , from parent components to child
components. This simplifies data management and makes it
easier to understand how data changes affect the
application.
'-'- Artem
~ : ~ @like _a_senior
16. What is the React lifecycle?
React components go through various lifecycle phases:
Mounting, Updating, and Unmounting
'-'- Artem
~ : ~ @like_a_senior
18. Explain React lifecycle methods.
List the most popular ones.
In React, class components have lifecycle methods that allow
you to execute code at specific points in a component's life.
These methods can be categorized into three main phases.
Class components are still supported by React, but we don't
recommend using them in new code.
The most popular methods:
• componentDidMount
• componentDidUpdate
• componentWillUnmount
• getSnapshotBeforeUpdate
• shouldComponentUpdate
'-'l. Artem
~~ ~ @like_a_senior