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)
