tech-interview

Table of Contents

Basics

What is React?

What are the major features of React?

What is JSX?

Is it possible to use React without JSX?

What is the difference between Element and Component?

What is the difference between createElement and cloneElement?

How to create components in React?

How to bind methods or event handlers in JSX callbacks?

How to pass a parameter to an event handler or callback?

Props and State

What is state in React?

What are props in React?

Why we need to be careful when spreading props on DOM elements?

What is children prop?

What is the key prop, and what is the benefit of using it in arrays of elements?

What are render props?

Can child component change the props passed from parent component?

Why we pass props as an argument in super?

What is the difference between state and props?

Why should we not update the state directly?

Is the state updated synchronously?

Refs

What is the use of refs?

How to create refs?

Optimization

How to prevent child component from re-rendering?

What would be the common mistake of function being called every time the component renders?

What is React.memo function?

React.memo VS useMemo

How do you memoize a component?

Virtual DOM

What is Virtual DOM?

How does Virtual DOM work?

What is the difference between Shadow DOM and Virtual DOM?

What is React Fiber?

What is the main goal of React Fiber?

What are the different phases of component lifecycle?

What are the lifecycle methods of React?

What are Higher-Order components?

How to fetch data with React Hooks?

What is context?

What is children prop?

What is reconciliation?

How do you conditionally render components?

What are error boundaries in React v16?

What are hooks? React hooks rules

What is Lifting State Up in React?

What are fragments? Why are fragments better than container divs?

Redux

What is Flux?

What is Redux?

What hooks does Redux have?

What are the core principles of Redux?

What are the downsides of Redux compared to Flux?

Can I dispatch an action in a reducer?

How to access Redux store outside a component?

What is the difference between React context and React Redux?

Should I keep all component’s state in the Redux store?

What is the proper way to access the Redux store?

What is an action in Redux?

What is the purpose of the constants in Redux?

Typescript

How do you create a functional component in React with TypeScript?

How can you handle form input in React with TypeScript, and how do you type input event handlers?

Explain the useState hook in React and how you can define its type with TypeScript.

Explain how to work with external libraries and non-TypeScript code in a React TypeScript project.

How can you define prop types with default values in React TypeScript components?

What is React’s synthetic event system, and how do you type event objects in TypeScript?

What are the advantages of using TypeScript with React over regular JavaScript?

Explain the role of the key prop in React, and how can you type it with TypeScript?

What are the benefits of using TypeScript’s strict mode in a React project, and how do you enable it?

How can you use TypeScript’s “strictNullChecks” option to improve code quality in a React TypeScript project?

Styling

What are Styled Components?

Give an example of Styled Components

Is it recommended to use CSS In JS technique in React?

React Router

What is React Router?

How React Router is different from history library?

React DOM

What is the use of react-dom package?

What is the difference between React and ReactDOM?

Why ReactDOM is separated from React?

What is the purpose of render method of react-dom?

Events

How events are different in React?

What are synthetic events?

How do you pass an event handler to a component?

How to programmatically trigger click event in React?

How to bind methods or event handlers in JSX callbacks?

Hooks

What is the purpose of the useLayoutEffect hook?

What is the purpose of the useImperativeHandle hook?

Explain the concept of the useDebugValue hook.

Diff

What is strict mode in React?

Why do we use arrow functions in React and what problem do they solve?

What are keys in React and why do we need them?