react-context

React useContext() performance, useContext inside custom hook

可紊 提交于 2020-08-19 08:38:28
问题 I used a structure using React Hooks. It is based on a global Context that contains a combination of reducers (as in the Redux). Also, I widely use custom hooks to separate logic. I have a hook that contains asynchronous API requests and it has become quite cumbersome and I have the opportunity to split almost every function of this hook into other hooks, but each of these functions uses a global context (more precisely - dispatch from useReducer()). So, questions: Is it ok to use useContext(

Apollo Client Cache vs. Redux

橙三吉。 提交于 2020-08-19 06:07:43
问题 I'm trying to migrate from Redux Store to use Apollo Client Cache that comes with Apollo Graphql Client. One of the key features that sets Apollo Client apart from other data management solutions is its normalized cache . Just by setting up Apollo Client, you get an intelligent cache out of the box with no additional configuration required. With Redux we have to write actions, types and dispatch actions based on the response received from the side-effect and set the data in the store using