M
M
Maxim Virchenko2020-07-03 19:53:15
React
Maxim Virchenko, 2020-07-03 19:53:15

What is the difference between dispatch() and a normal function call with dispatches inside?

Everywhere they write that redux-thunk makes dispatches asynchronous, but without them, a function with the same asynchronous dispatches can be called on an event. What's the catch? And why are they even needed then?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-07-03
@MaksVI

As soon as you take the function that performs the asynchronous action outside the component, you will need to manually forward dispatch and getState into it. redux-thunk does this for you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question