Middleware action dispatch અને action reducer સુધી પહોંચવા વચ્ચે બેઠું હોય છે, તમને actions ને intercept કરવા દે છે તાકી side effects (async API calls, logging) સંભાળી શકો — જે reducers કરી શકતા નથી કારણ કે તેઓ pure રહેવા જોઈએ. Thunks સૌથી સામાન્ય middleware છે, async logic સક્ષમ કરે છે.
Middleware ક્યાં બંધબેસે છે
dispatch(action) → [ middleware 1 → middleware 2 → ... ] → reducer → store
(can inspect, modify, delay, or stop actions; do side effects)
