Understanding the state management
Managing the state in modern frontend development is a complex task. Nearly every application has to retrieve data from a remote server via a network – we can call this data remote states. Remote state originates from an external source, typically a backend server or API. This is in contrast to local state, which is generated and managed entirely within the frontend application itself.
There are many dark sides of remote states, making the frontend development difficult if you don’t pay close attention to them. Here, I’ll just list a few obvious considerations:
- Asynchronous nature: Fetching data from a remote source is usually an asynchronous operation. This adds complexity in terms of timing, especially when you have to synchronize multiple pieces of remote data.
- Error handling: Connections to remote sources might fail or the server might return errors. Properly managing these scenarios for a smooth user experience...