Skip to content

React Interview Study Guide for Java Full Stack Developers

For a senior Java Full Stack role, React interviews typically emphasize:

  • React fundamentals
  • Components and JSX
  • Hooks
  • State management
  • Component lifecycle
  • Performance optimization
  • Routing
  • API integration
  • JWT authentication
  • React architecture
  • React + Spring Boot integration

React is a JavaScript library for building user interfaces using reusable components.

  • Component-based architecture
  • Virtual DOM
  • One-way data flow
  • Declarative programming
function Welcome() {
return <h1>Hello World</h1>;
}

Virtual DOM is a lightweight in-memory representation of the Real DOM.

flowchart TD
A[State Changes] --> B[Create New Virtual DOM]
B --> C[Compare with Previous Virtual DOM]
C --> D[Find Differences]
D --> E[Update Only Changed Nodes in Real DOM]
  • Faster rendering
  • Fewer DOM manipulations
  • Better performance
Real DOM Virtual DOM
Slow Fast
Updates entire DOM Updates only changed nodes
Browser dependent JavaScript object
More memory intensive Efficient

function User() {
return <h1>User</h1>;
}
class User extends React.Component {
render() {
return <h1>User</h1>;
}
}

Functional components are preferred today.


JSX allows HTML-like syntax inside JavaScript.

const element = <h1>Hello</h1>;

JSX is compiled into JavaScript by Babel.


Read-only values passed from parent to child.

function Employee(props) {
return <h1>{props.name}</h1>;
}
<Employee name="Abirami" />

Stores mutable component data.

const [count, setCount] = useState(0);
Props State
Read-only Mutable
Parent-owned Component-owned
External Internal

useState lets functional components store and update local state, triggering a re-render on change. See the React useState Interview Guide for update batching, functional updates, lazy initialization, and immutability rules.

Used for side effects such as API calls, timers, and subscriptions. See the React useEffect Interview Guide for dependency-array behavior, cleanup functions, stale closures, and useEffect vs useLayoutEffect.

useEffect replaces componentDidMount, componentDidUpdate, and componentWillUnmount depending on its dependency array. See the React Lifecycle Using Hooks guide for a full walkthrough with execution order and cleanup timing.

useRef stores a mutable value that persists across renders without triggering a re-render when updated. Useful for DOM access and mutable values. See the React useRef Interview Guide for persistence mechanics, forwardRef/useImperativeHandle, and avoiding stale closures.

useMemo caches the result of an expensive computation and recomputes it only when its dependencies change. See the React useMemo Interview Guide for dependency-array behavior, the React.memo interaction, and why it isn’t a correctness guarantee.

useCallback memoizes a function reference between renders. See the React useCallback Interview Guide for the stale closure problem, React.memo interaction, and dependency-array pitfalls.

Caches function references.

useMemo useCallback
Caches values Caches functions
  • Call hooks only at the top level.
  • Never call hooks inside loops or conditions.
  • Use hooks only inside React components or custom hooks.

Bad:

if (user) {
useEffect(() => {}, []);
}

Good:

useEffect(() => {
if (user) {
// logic
}
}, [user]);

export default React.memo(User);

Prevents unnecessary re-renders when props remain unchanged.


const UserContext = createContext();

Used to avoid prop drilling.

See the React Context API Interview Guide for Provider/Consumer patterns, re-render behavior, Context vs Redux, and performance optimization with useMemo.


React Router provides Single Page Application (SPA) navigation without full page reloads. See the React Routing Interview Guide for BrowserRouter vs HashRouter, nested routes, navigation hooks, protected routes, and query parameters.


useEffect(() => {
fetch("/api/users")
.then(res => res.json())
.then(data => setUsers(data));
}, []);
axios.get("/api/users");
try {
const response = await axios.get("/users");
} catch (error) {
console.error(error);
}

users.map(user => (
<li key={user.id}>{user.name}</li>
));

Keys uniquely identify list elements during reconciliation.


Techniques:

  • React.memo
  • useMemo
  • useCallback
  • Lazy Loading
  • Code Splitting
  • Pagination
  • Debouncing
  • Virtualization

React.lazy and Suspense load components on demand instead of bundling them upfront. See the React Code Splitting Interview Guide for route-based splitting, dynamic imports, and the internal chunk-loading flow.


src/
- components/
- pages/
- services/
- hooks/
- context/
- utils/
- routes/
- assets/
- App.jsx

React minimizes expensive DOM operations by comparing Virtual DOM trees and updating only changed nodes.

flowchart LR
A[Old Virtual DOM] --> B[Compare]
C[New Virtual DOM] --> B
B --> D[Diff]
D --> E[Update Changed Nodes]

React assumes:

  • Different element types produce different trees.
  • Stable keys uniquely identify children.
const [name, setName] = useState("");
<input
value={name}
onChange={(e) => setName(e.target.value)}
/>
const inputRef = useRef();
<input ref={inputRef} />

Controlled components are preferred in enterprise applications.


React combines multiple state updates into a single render for better performance.

React 18 performs automatic batching even for asynchronous operations.


  • React.memo
  • useMemo
  • useCallback
  • Keep state local
  • Virtualized rendering

Recommended structure:

components/
- Button
- Input
- Modal
- Table
- Dropdown

Design principles:

  • Reusable
  • Configurable
  • Accessible
  • Themeable
  • Well documented

Best practices:

  • Never store secrets in frontend code.
  • Use HTTPS.
  • Prevent XSS.
  • Prefer HttpOnly cookies for JWT.
  • Validate input on both frontend and backend.
  • Implement Role-Based Access Control (RBAC).

React authenticates against Spring Boot by sending credentials, storing the returned JWT, and attaching it as a Bearer token on every subsequent request via an Axios interceptor.

Production recommendations:

  • Short-lived access tokens
  • Refresh tokens
  • HttpOnly cookies

See the React + Spring Boot Integration Interview Guide for the full JWT sequence diagram, Axios interceptor code, CORS configuration, centralized error handling, file upload/download, and deployment strategies.


flowchart TD
A[React UI] --> B[API Gateway]
B --> C[User Service]
B --> D[Order Service]
B --> E[GST Service]

API:

axios.get("/api/users");

Handle:

  • CORS
  • JWT
  • Global error handling

React Fiber is the rendering engine introduced in React 16.

Benefits:

  • Incremental rendering
  • Task prioritization
  • Concurrent rendering
  • Better responsiveness

Code splitting breaks a large JavaScript bundle into smaller chunks loaded on demand, reducing initial load time. See the React Code Splitting Interview Guide for implementation techniques, vendor splitting, and bundle analysis.


Recommended approaches:

  • Server-side pagination
  • Infinite scrolling
  • Virtualization
  • Lazy loading

Topics Every Senior Java Full Stack Developer Should Know

Section titled “Topics Every Senior Java Full Stack Developer Should Know”

See the React Interview Topics roadmap for the full priority breakdown and interview frequency of each topic.

  • Master React fundamentals before advanced optimization.
  • Understand Hooks deeply, especially useEffect, useMemo, useCallback, and useRef.
  • Be comfortable integrating React with Spring Boot using REST APIs and JWT authentication.
  • Learn performance optimization techniques including reconciliation, memoization, lazy loading, and virtualization.
  • Prepare architectural discussions around reusable components, security, routing, and project structure.