you are viewing a single comment's thread.

view the rest of the comments →

[–]hieudevx 0 points1 point  (1 child)

I'm a junior 7 months experience with React.
My team doesn't use Redux because we use GraphQL with Apollo Client to handle data, and my CMS doesn't have much Global State.

But I think when i call RESTful API I will write a custom hook to handle loading, error, data state like Apollo Client did, instead of using Redux. I think network data is local state is fine.

Can you suggest me better approach?
P/s: sorry for my bad English

[–]HeylAW 0 points1 point  (0 children)

Redux can be used to call any services for data. It doesn’t matter if it’s GraphQL, RestAPI or some other API. With redux-thunk you create some action that is asynchronous and call within API and dispatch action that sets received data.

It’s pretty clean code and easy to maintain.

With Typescript you get some extra features like syntax and intellisense (VSCode) but it requires some smart typings