Open piotrwitek opened 6 years ago
@boostio funded this issue with $40. Visit this issue on Issuehunt
@issuehunt has funded $50.00 to this issue.
Hi @piotrwitek , I've found 2 libraries that solve this: https://github.com/devexperts/remote-data-ts https://github.com/abraham/remotedata
Hope it helps.
Add a new section with patterns on how to model data structures using static-typing to make the incorrect state unrepresentable. This should prevent a lot of edge cases and various display bugs by constraining our data structure to only represent correct state and also require our UI components to always handle all possible representable states when implementing a view components for the particular piece of data.
Rough sketch for this pattern:
Instead of modelling your remote data in reducer like this:
Do it like this:
Now implement your component like this: