Web Fundamentals

Redux: Predictable State Container (RTK + RTK Query)

Web Fundamentals Map

Rendering & Browser Architecture

Critical Rendering PathScript Loading Patterns (async/defer)Event Loop Deep DiveJavaScript Module Systems (CJS, ESM, UMD)Dynamic Module Loading (import())Import on InteractionImport on VisibilityBrowser Rendering Pipeline & Layout ThrashingRendering Strategies (CSR, SSR, SSG, ISR)Streaming SSR & Progressive HTMLIslands ArchitectureReact Server ComponentsFramework Reactivity (React, Vue, Svelte, Solid)HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)DNS Resolution & TTL Caching

Performance

Core Web Vitals: LCP, INP, CLSPerformance Optimization Trade-offsCritical Resource PrioritizationCode Splitting & Dynamic ImportsTree Shaking & Dead Code EliminationLazy LoadingResource Hints: Preload, Prefetch & PreconnectText Compression: Gzip & BrotliImage & Video OptimizationAdaptive LoadingList VirtualizationWeb Workers vs Main ThreadMemory Leaks: Detection & PreventionManaging Third-Party ScriptsHow CDNs WorkHTTP Caching Deep DiveService Workers & Offline StrategyPWA Fundamentals

Security

Cross-Site Scripting (XSS)Cross-Site Request Forgery (CSRF)CORS ExplainedCORS Preflight, Credentials & MisconfigurationsContent Security Policy (CSP)Why is HTTPS Secure? (TLS/SSL)Authorization Best PracticesCookie Security & Session Hardening

State & Data Architecture

State Management Guide (Context vs Zustand vs Redux)React Query & Server State CachingData Fetching PatternsCaching StrategiesPagination: Offset vs Cursor-BasedReal-time Communication (WebSocket, SSE, Polling)
mediumWeb Fundamentals

Redux: Predictable State Container (RTK + RTK Query)

Learn the interview-ready mental model, practical trade-offs, and production patterns for this web fundamentals topic.

Topic content

TL;DRRedux Toolkit for complex shared state. RTK Query for server data. Use selectors + normalization for performance.
High Signal
Google
Meta
Netflix
Agoda
30-Second Answerstart every interview with this

Redux provides predictable state updates and excellent debugging. Modern Redux = Redux Toolkit (slices, configureStore, createAsyncThunk) + RTK Query for server state. Use it when you need strong architecture for complex shared state and large teams.

The store is the single source of truth. Actions are formal requests to change state. Reducers are the only editors allowed to update the store. This predictability makes debugging and testing much easier at scale.

UI dispatches action
Reducer computes new state (Immer allows 'mutation')
Selectors compute derived views
Components re-render only when needed

1Redux Toolkit Patterns

Use createSlice for state + reducers + actions. configureStore for store setup. createAsyncThunk for async logic.

counterSlice.tsts
import { createSlice } from '@reduxjs/toolkit';

const counterSlice = createSlice({
  name: 'counter',
  initialState: { value: 0 },
  reducers: {
    increment: (state) => { state.value += 1 }
  }
});

export const { increment } = counterSlice.actions;
export default counterSlice.reducer;

2Performance: Normalization + Selectors

Store entities by ID (normalized). Use selectors and createSelector (Reselect) to compute derived data efficiently and prevent unnecessary rerenders.

3RTK Query for Server State

The recommended way to handle API data in Redux. Automatic caching, deduping, invalidation with tags, and optimistic updates.

Key Takeaways
  • ✓Redux = predictable shared state container
  • ✓Modern Redux = Redux Toolkit everywhere
  • ✓RTK Query = best for server/API state
  • ✓Normalize entities by ID for performance
  • ✓Use selectors (createSelector) to avoid rerenders
  • ✓Redux is a team-scale and debugging tool
  • ✓Measure and optimize based on real rerender patterns
PreviousNext

Topic Guide

On this page