Unit 2: Component Design and Styling - Subjective Questions

INT252 — Web App Development With Reactjs • Practice Questions with Detailed Answers

20 questions

1

Define a functional component in ReactJS. Explain its structure, purpose, and advantages with a suitable example.

2

Explain how props-driven component reusability works in React. Illustrate your answer by designing a reusable Button component.

3

Describe component composition patterns in React. Compare composition using the children prop with composition using named props.

4

Explain the purpose of reusable component abstractions in React applications. What principles should be followed while creating such abstractions?

5

Discuss conditional rendering strategies in React. Explain how if statements, ternary expressions, logical AND, and early returns can be used appropriately.

6

Explain the concept of lifting state up in a React component hierarchy. Describe the data flow involved in a shared counter example.

7

What are component responsibility boundaries? Explain how clearly defining these boundaries improves the design and maintenance of React applications.

8

Compare major styling approaches used in React applications, including regular CSS, CSS Modules, inline styles, CSS-in-JS, and utility-first frameworks.

9

Explain the fundamental concepts of Tailwind CSS. Describe how utility classes can be used to style a React component.

10

What is the utility-first styling methodology? Explain its benefits and limitations when used in React projects.

11

Describe responsive design using Tailwind CSS breakpoints. Show how a React layout can change between small, medium, and large screens.

12

Explain how reusable UI styling patterns can be implemented in React with Tailwind CSS. Include examples of variants and class composition.

13

Define accessibility in the context of React applications. Explain why accessibility must be considered during component design rather than added later.

14

Explain semantic HTML practices in React. Distinguish between semantic elements and generic elements such as div and span.

15

Design a reusable accessible form-field component in React. Explain the role of labels, IDs, validation messages, and ARIA attributes.

16

Explain the difference between state and props in React. Describe when data should remain local and when it should be lifted to a parent component.

17

Analyze a React component that contains data fetching, form handling, layout markup, and several unrelated conditional branches. Explain how you would refactor it using responsibility boundaries and composition.

18

Compare composition and inheritance as approaches for sharing UI behavior in React. Why is composition generally preferred?

19

Explain how conditional rendering, loading states, empty states, and error states should be organized in a data-driven React component.

20

Develop a strategy for making a Tailwind-styled React application responsive and accessible at the same time.