Tech Prescient
DIGITAL SEVA ROHISA Interview Questions and Answers
Q1. What are props in React and how are they different from state
Props are used to pass data from parent to child components in React, while state is used to manage data within a component.
Props are read-only and cannot be modified by the child component
Props are passed down from parent to child components
State is mutable and can be changed within the component
State is managed internally by the component
Q2. What is axios and used of interceptors in it?
Axios is a popular JavaScript library for making HTTP requests in web applications. Interceptors are used to intercept and modify HTTP requests and responses.
Axios is a promise-based HTTP client for the browser and Node.js.
Interceptors in Axios allow you to run middleware functions before a request is sent or after a response is received.
Interceptors can be used for logging, authentication, error handling, and more.
Example: Adding a token to the request headers before sending...read more
Q3. What is purpose of keys in React lists?
Keys in React lists are used to uniquely identify elements and improve performance by helping React identify which items have changed, are added, or are removed.
Keys help React identify which items have changed, are added, or are removed in a list of elements.
Keys should be unique among siblings but do not need to be globally unique.
Using keys improves performance by helping React efficiently update the UI without re-rendering all elements.
Keys should be stable, predictable, ...read more
Q4. What are the higher order components?
Higher order components are functions that take a component and return a new component with additional functionality.
Higher order components are a common pattern in React for code reuse and logic sharing.
They are used to abstract logic out of components and make them more reusable.
Examples include withRouter, connect, and withStyles in React.
Q5. What is useMemo and useCallback hooks
useMemo and useCallback are React hooks used for performance optimization by memoizing values and functions respectively.
useMemo is used to memoize the result of a function so that it is only recomputed when its dependencies change.
useCallback is used to memoize a function instance so that it is not recreated on every render unless its dependencies change.
Both hooks help in optimizing performance by preventing unnecessary re-renders in React components.
Q6. What is callback in JS?
A callback in JS is a function passed as an argument to another function, to be executed later.
Callback functions are commonly used in event handling, asynchronous programming, and AJAX requests.
They allow for more flexible and dynamic code execution.
Example: setTimeout(function(){ console.log('Hello') }, 1000);
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month