V
V
Vadim Stepanenko2021-03-02 15:26:57
React
Vadim Stepanenko, 2021-03-02 15:26:57

Where to make ajax requests: in hooks or in redux actoins?

Hey!
I study hooks, before that I wrote on class components for half a year. React + redux bundle.
I made requests to api in redux actions using redux thunk. And in relatively large projects, the file with actions grew very large.

Actually the question is: where to make ajax requests: in hooks (own hooks) or in redux actoins?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2021-03-02
@Casufi

if you use thunk or saga there and keep making requests, nothing has changed.

V
Vladimir Lewandowski, 2021-03-02
@vovaspace

And in relatively large projects, the file with actions grew very large.

This is not a reason to switch from action to hooks. The number of hooks in a component can also grow. It's a matter of code organization.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question