FSD Module 4 Question Bank
FSD Module 4 Question Bank
2. What is the significance of "lifting state up" in React, and how does it affect component
architecture?
Describe the process of lifting state up in React. Why is it necessary, and what problems does
it solve in managing state between multiple components? Provide an example where lifting state
up improves the flow of data between components.
3. How do you update the state in a React component, and what are the best practices for
managing state updates in a complex application?
Explain the process of updating state both in class components (`this.setState`) and functional
components (`useState`). What are the risks of direct state mutation, and how can you use hooks
like `useEffect` to handle side effects efficiently?
4. How does React handle the communication between components in different levels of the
component tree?
Describe various methods for component communication in React, including props, callbacks,
context, and state management solutions (e.g., Redux). Discuss the trade offs of each approach in
terms of maintainability and performance.
5. How would you design a scalable React component structure for a complex application,
keeping in mind separation of concerns and reusability?
What strategies would you use to design React components that are modular, reusable, and
maintainable in a large scale application? Consider the use of hooks, HOCs (Higher Order
Components), and context for state management.
6. What are the challenges in managing side effects in React (e.g., fetching data, subscribing to
services), and how do you manage them using hooks like `useEffect`?
Explain how side effects like data fetching or subscribing to external services are handled in
React using hooks. What problems can arise with managing multiple asynchronous tasks, and
how can you optimize this process with cleanup, `useEffect`, or libraries like Redux Saga?
7. How does Express.js simplify building RESTful APIs, and what are some common practices
for structuring API routes and middleware?
Describe how Express handles HTTP requests and responses. What are some best practices
for organizing routes and middleware, and how does Express enable efficient request handling
for RESTful APIs?
8. What are the key differences between REST API and GraphQL in terms of performance,
flexibility, and ease of use?
Compare REST and GraphQL from the perspective of querying data, performance (e.g., over
fetching/under fetching), and the flexibility they offer for clients. Discuss when you would prefer
one over the other.
9. How do you implement a strongly typed GraphQL API, and what benefits does this bring to
the development process?
Explain how GraphQL schema definition language (SDL) is used to create a strongly typed
API. How does type safety improve debugging and development efficiency?
10. What are query variables in GraphQL, and how can they be used to make API calls more
dynamic and reusable?
Explain how query variables work in GraphQL and how they allow clients to send dynamic
input to a query. Provide an example of how query variables can optimize API calls.
What is react state? Explain what happens when state changes? Create a script for Initializing and
Modifying State.
List and explain commonly used mapping of CRUD operations to HTTP methods and resources in
Express.