0% found this document useful (0 votes)
3 views

React-Interview

The document discusses the distinction between components and elements in React, explaining that components are functions or classes that return React elements. It covers Redux Thunk for handling asynchronous actions, including data fetching and optimistic updates, as well as the core components of Redux like store, actions, dispatch, and reducers. Additionally, it mentions Babel for transpiling JSX and Webpack for bundling code, along with concepts like component lifecycle, error boundaries, and React Hooks.

Uploaded by

Sabas Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

React-Interview

The document discusses the distinction between components and elements in React, explaining that components are functions or classes that return React elements. It covers Redux Thunk for handling asynchronous actions, including data fetching and optimistic updates, as well as the core components of Redux like store, actions, dispatch, and reducers. Additionally, it mentions Babel for transpiling JSX and Webpack for bundling code, along with concepts like component lifecycle, error boundaries, and React Hooks.

Uploaded by

Sabas Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Component vs Element – Elements are plain JavaScript objects that describe what you want to

see on the screen. A component is a function or a Class which


optionally accepts input and returns a React element.

Synthetic Events:

Redux Thunk Application-

1. Data Fetching
a. Large-scale applications often need to fetch data from multiple APIs or endpoints.
Redux-Thunk allows you to encapsulate these asynchronous operations in action
creators.
b. You can handle scenarios like fetching initial data when a component mounts,
paginating through large datasets, or refreshing data periodically.
2. Optimistic Updates
a. In applications where user interactions trigger asynchronous actions with optimistic
UI updates, Redux-Thunk can help manage the flow of actions.
b. You can dispatch optimistic actions to update the UI immediately and then dispatch
additional actions based on the success or failure of the asynchronous operation.

The key components that enable this centralized approach to state management are:

1. Store - holds all the data for your application. single source of truth for your application's
state.
2. Actions - An action is an object that describes what changes need to be made to the state of
your application. It sends data from your application to the Redux store and serves as the
only way to update the store. Type and payload properties. Action creators are functions that
create and return action objects.
3. Dispatch - a function provided by the store that allows you to send an action to update the
state of your application.
4. Reducers - a function that takes in the current state of an application and an action as
arguments, and returns a new state based on the action

Babel is used to transpile JSX code into plain JavaScript. JSX is a syntax extension for JavaScript that
allows you to write HTML-like code within JavaScript. Since browsers do not natively understand JSX,
Babel converts it into standard JavaScript functions that browsers can execute

Webpack is a bundler that uses a dependency graph to bundle our code and assets (incuding static
assets such as images) into a ‘bundle’ which we can then deploy.

Component Life Cycle


What are error boundaries?

What are the rules that must be followed while using React Hooks

Pure function – return same output for same input

useReducer - useReducer is a React Hook that lets you add a reducer to your component.

const [state, dispatch] = useReducer(reducer, initialArg, init?)

Links –

Top 100 ReactJS Interview Questions 2025 - Vskills Blog

About Queries | Testing Library

You might also like