Re-writing redux application with GraphQL & Apollo
Redux is a very good state management library for building large applications. But we noticed that we were writing lot of custom logic for complex functionality like caching, pagination, live editing, real-time updates from server. We implemented abstractions to reduce verbosity of redux code. But, new developers were finding it hard to understand these abstractions. We explored GraphQL and Apollo and found that it could solve lot of our problems. We were able to leverage functionality of GraphQL and Apollo to implement features like caching and real-time updates and get rid lot of custom logic. After moving network state to Apollo, very small amount of application state is remaining in redux. We leveraged local state management feature of apollo 2 and removed redux dependency completely from app.
- Introduction of GraphQL and Apollo
- Step followed in re-writing redux application with GraphQL and Apollo
- Benefits we observed after re-writing the application
Kiran Abburi is a freelance developer who primarily works on react projects. He has 3 years of experience with react. He also organises reactjs meetup group in Bangalore