Past Interview Experience on Redux Middlewares !! Interviewer: What happens in the Action Creator? Me: The Action Creator functions generate actions – these are plain JavaScript objects that describe what happened. For instance, it might look something like { type: 'INCREMENT' }. Interviewer: So, these actions need to go somewhere, right? Me: The actions are then dispatched to the Store. But before they reach the reducers, they pass through Middlewares. Interviewer: Middlewares, you say? What role do they play? Me: Middlewares is between the action dispatch and the reducers. They can intercept actions and perform tasks such as logging, making asynchronous API calls, or modifying actions before they reach the reducers. Essentially, they're like filters. Interviewer: So once the middleware is done with the action, what happens next? Me: Once the middleware processes the action, it's forwarded to the Reducers. The reducers are pure functions that take the current state and the action as arguments and return a new state based on the action. This is where the state transformation happens. Interviewer: And what does the new state do after the reducer updates it? Me: The new state is then stored in the Store. The store holds the entire state of the application. When the state updates, the view re-renders to reflect the changes. This closes the loop, showing the user the updated state. Interviewer: And what about the API call? Me: If an action involves an API call, middleware can handle that too. For instance, thunk middleware allows action creators to return functions instead of actions. These functions can perform asynchronous operations like API calls, then dispatch actions based on the results. Interviewer: So, to summarize, the flow goes from View to Action Creator, then through Middleware, to the Store, through the Reducer, and back to the Store, which updates the View. Did I get that right? Me: Perfect! You've got it. It's a continuous loop that ensures the state and view stay in sync. . . . . . If you find my explanation effective, give it a like, and share any observations or suggestions in the comments. For more insightful content checkout below: 🟦 𝑳𝒊𝒏𝒌𝒆𝒅𝑰𝒏 - https://lnkd.in/dwi3tV83 ⬛ 𝑮𝒊𝒕𝑯𝒖𝒃 - https://lnkd.in/dkW958Tj 🟥 𝒀𝒐𝒖𝑻𝒖𝒃𝒆 - https://lnkd.in/dDig2j75 or Priya Frontend Vlogz 🔷 𝐓𝐰𝐢𝐭𝐭𝐞𝐫 - https://lnkd.in/dyfEuJNt #frontend #javascript #react #reactjs #html #css #typescript #es6 #interviewquestions #interview #interviewpreparation
Really very helpful post.
Thank you for sharing this 🙏
Great share Priya Bagde ⭐ CrackInterview
Nice explanation
Priya Bagde ⭐ How did you made this design ..which animation tool did you used to make this flow..I just want to know bcz ..I have to represent same in my team..if have anything ..could you please comment ur tool which is best
Really helpfull 🔥
Very helpful!
Great
Thank you 👍
Associate Full-Stack Developer @ GWC Data.AI
4moThank you for this post Priya Bagde ⭐ 🙌