MENU

Fun & Interesting

How to Persist Redux State to an API Part 3

Covalence 887 lượt xem 2 years ago
Video Not Working? Fix It Now

Part 1 of the Series:
https://youtu.be/SzrUQLced98
- we coded a hacky configureStoreAsync function in this video

Part 2 of the Series:
https://youtu.be/IHOA4ftOw7Y
- we coded a new rootReducer that wrapped our original reducer, and it had a check for a custom action object to hydrate our store from the "top" level

GitHub Repo for Starting Boilerplate:
https://github.com/przekwas/persisting-redux-starter

A student working on their final project asked me how they could asynchronously save *and* preload their Redux state using their API. This series are the solutions we either found and came up with!

In the first video we did a configureStoreAsync solution that had its pros and cons. The second video covered a singular dispatched action that hydrates the entire redux store with our saved state! Super cool. It feels like a good redux style solution compared to the first.

This video will cover the often used library redux-persist https://github.com/rt2zz/redux-persist

We utilize a custom storage object that we can pass to our persisted store that will communicate with our api.

Don't forget to like this video and subscribe to our channel – we're publishing more videos and walkthroughs every week. Comment below and let us know what you'd like to see next!

Join the Covalence community: https://covalence.io

Shop Covalence merch: https://covalence.merchntly.com

Comment