| Question |
Answer |
| What are reducers in React? | Pure functions that take state and action, and return updated state—often used with useReducer and Redux. |
| When would you use useReducer instead of useState? | For complex state logic or when the next state depends on the previous state. |
| What are the parts of Redux architecture? | Actions, Reducers, Store, and optionally Middleware. |
| How does Redux Middleware work? | Intercepts actions before they reach reducers—used for async logic like API calls (e.g., Thunk, Saga). |
| What are selectors in Redux? | Functions that extract specific slices of state—often memoized with reselect to improve performance. |
| What is Zustand and how is it different from Redux? | Zustand is a lightweight state management library using hooks, less boilerplate, and no actions/reducers. |
| How do you persist state in React apps? | Use localStorage, sessionStorage, or libraries like redux-persist. |
| What are server components in React? | A new React feature allowing components to render on the server without sending additional JS to the client. |
| What is hydration in React? | The process where client-side JS takes over server-rendered HTML to make it interactive. |
| How do you deploy a React app? | Common methods include Netlify, Vercel, GitHub Pages, AWS Amplify, Firebase Hosting, or custom CI/CD pipelines. |
| How do you ensure accessibility (a11y) in React apps? | Use semantic HTML, ARIA attributes, focus management, keyboard navigation, and screen reader support. |
| What is the role of ARIA attributes in accessibility? | ARIA (Accessible Rich Internet Applications) helps define UI roles, states, and properties for assistive technologies. |
| How do you test accessibility in React? | Use tools like axe-core, Lighthouse, and React Testing Library with accessibility matchers. |
| Why is semantic HTML important? | Improves accessibility, SEO, and maintainability—elements convey meaning and structure (e.g., |
| How to manage keyboard interactions in React? | Use onKeyDown or onKeyPress handlers and manage tabIndex to ensure navigability. |