Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Oh Hello Apollo client, Goodbye Redux!

Oh Hello Apollo client, Goodbye Redux!

Ankita Kulkarni

March 31, 2021
Tweet

More Decks by Ankita Kulkarni

Other Decks in Programming

Transcript

  1. @kulkarniankita9 Redux world request CART SUCCESS CART ERROR CART REQUEST

    ActionType.CART_REQUEST ActionType.CART_ERROR ActionType.CART_SUCCESS
  2. @kulkarniankita9 No need for actions 🙅 CART SUCCESS CART FAILURE

    CART REQUEST ActionType.LOGIN_REQUEST ActionType.LOGIN_FAILURE ActionType.LOGIN_SUCCESS
  3. @kulkarniankita9 I still had questions, how do we? • Normalize

    data • Handle async actions • Trigger state updates in the component • And remember selectors? • Transform data
  4. @kulkarniankita9 Apollo client 🚀 • automatically caches your data by

    generating a unique ID • Normalizes new data in query responses and after mutation • Stores data using references so it can look up data easily
  5. @kulkarniankita9 • Store local state outside the Apollo client cache

    • You can store whatever you want in whatever shape you want • Modifying them triggers a update Reactive variables 🌸
  6. @kulkarniankita9 Take away 🚀 • You take control or give

    away your control a little • In Redux, we were doing a LOT! • Using Redux and Apollo client with GQL redundant data • You need to understand how Apollo client works