what is better practice when getting data from API, should I fetch it in React component and then send data to Redux to put it in state or should i use redux thunk and use fetch request directly in Redux, and then just get state in React?
Tbh Redux with React is a lot of overhead, if you truly just started using it. I would stop 🛑 and take a look at Reacts built in tools such as the Context API
There is also redux saga
i think redux saga is a better aproach
if you will need to fetch this data from different components
Its a part of some assignment I got, they want me to use Redux with React, so im just wondering what is best practice. Other solution is to use MobX but I never used it and want to stick with something im familiar with.
I agree with the fact that it is a lot of overhead, but it is use in a lot of projects, so it is a must to know basically
You may want to check redux-toolkit, it reduces a lot of boilerplate code
Обсуждают сегодня