37.9k views
1 vote
Whats the difference between redux and redux-thunk?

1 Answer

5 votes

Final answer:

Redux is a state management library for JavaScript apps, while Redux-Thunk is a middleware that allows asynchronous actions within Redux.

Step-by-step explanation:

The difference between Redux and Redux-Thunk pertains to their roles within the Redux ecosystem for managing state in JavaScript applications. Redux is a state management library that provides a single source of truth for the state of an application, making it predictable and easy to manage. It uses actions to describe changes and reducers to specify how the state is updated in response to these actions.

On the other hand, Redux-Thunk is a middleware that extends Redux's capabilities, allowing for asynchronous actions. Thunks enable you to write action creators that return a function instead of an action. This function can then perform asynchronous operations (like API calls) and dispatch regular actions when the data is available or when certain conditions are met. Redux-Thunk is often used in scenarios where you need to handle side-effects in your Redux application.

User Jrsala
by
8.9k points