Mid From PDF React React.js

What are thunks and sagas?

Short answer: ctions Generator-based side effects Complexity Simple Advanced Syntax Imperative (JS functions) Declarative (generators/yield) Use case Basic async logic Complex flows, retries, delays ✅ Thunk const fetchUser = () => (dispatch) => { fetch("/api/user") .then(res => res.json()) .then(data => dispatch({ type: "SET_USER", payload: data… })); }; ctions… Generator-based side effects Complexity Simple Advanced Syntax…

Explain a bit more

Imperative (JS functions) Declarative (generators/yield) Use case Basic async logic Complex flows, retries, delays ✅ Thunk

Example code

const fetchUser = () => (dispatch) => { fetch("/api/user") .then(res => res.json()) .then(data => dispatch({ type: "SET_USER", payload: data })); }; ctions Generator-based side effects Complexity Simple Advanced Syntax Imperative (JS functions) Declarative (generators/yield) Use case Basic async logic Complex flows, retries, delays ✅ Thunk example: const fetchUser = () => (dispatch) => { fetch("/api/user") .then(res => res.json()) .then(data => dispatch({ type: "SET_USER", payload: data… })); }; ctions Generator-based side effects Complexity Simple Advanced Syntax Imperative (JS functions) Declarative (generators/yield) Use case Basic async logic Complex flows, retries, delays ✅ Thunk example: const fetchUser = () => (dispatch) => { fetch("/api/user") .then(res => res.json()) .then(data => dispatch({ type: "SET_USER", payload: data })); };

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details