Q11. What is state in React?
_State_ of a component is an object that holds some information that may change over the lifetime of the component. The important point is whenever the state object chang...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (154 available).
_State_ of a component is an object that holds some information that may change over the lifetime of the component. The important point is whenever the state object chang...
In React, both **state** and **props** are plain JavaScript objects, but they serve different purposes and have distinct behaviors: ### State - **Definition:** State is a...
You can use either _if statements_ or _ternary expressions_ which are available in JS(and JSX in React) to conditionally execute or render expressions. Apart from these a...
A **controlled component** is a React component that **fully manages the form element's state**(e.g, elements like ``, ``, or ``)) using React's internal state mechanism....
The **Uncontrolled components** are form elements (like ``, ``, or ``) that **manage their own state internally** via the **DOM**, rather than through React state. You ca...
When several components need to share the same changing data then it is recommended to _lift the shared state up_ to their closest common ancestor. That means if two chil...
If the behaviour of a component is independent of its state then it can be a stateless component. You can use either a function or a class for creating stateless componen...
If the behaviour of a component is dependent on the _state_ of the component then it can be termed as stateful component. These _stateful components_ are either function ...
In some cases you want to render different components depending on some state. JSX does not render `false` or `undefined`, so you can use conditional _short-circuiting_ t...
You can use the `useState` hook to manage the width and height state variables, and the `useEffect` hook to add and remove the `resize` event listener. The `[]` dependenc...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.