Member-only story

Hydration for Angular Apps: Tips and Tricks for Optimal Performance

Guillaume Ferber
5 min readMar 10, 2023

--

Introduction

Are you tired of losing your precious app state every time you reload or reopen your application? Fear not, for re-hydration is here to save the day!

Re-hydration, a process of restoring your application state through serialization, is a built-in feature in NgRx/Store. However, if you’re using a custom state management system, you’ll need to implement re-hydration yourself.

In this article, we’ll guide you through the process of creating a dedicated reducer method for re-hydration, allowing you to keep your state management organized and maintainable. Plus, with the added bonus of a bit of humor, you might even enjoy the process!

Re-Hydration

In the context of NgRx/Store, the library provides built-in support for re-hydration through a process called serialization, which involves converting the application state into a format that can be stored and then restored when the application is reloaded.

Although re-hydration of the state through serialization is an effect operation, it must be performed in a reducer because setting the state directly from an effect is not possible. In NgRx/Store, effects are used to perform side effects like making HTTP requests, but they cannot…

--

--

Guillaume Ferber
Guillaume Ferber

Written by Guillaume Ferber

Montreal based Full-Stack Web Developer 🔥

No responses yet