Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reagent comp instead of re-frame sub for img loading
Notwithstanding the bug in the previous commit, I'm unsure about what I shall choose: - Re-frame subscription is more declarative: you know what happen by reading the code, there's only on if so it's crystal clear. - Reagent component encapsulates all the complexity: you only have the name to read. - The subscription is limited to resource availability: it doesn't currently handle progressive loading like the component but you could provide it with a list of URL and it would do the same. - If you use the sub, you get full power, hence full responsability over state management: you have to define the spinner. It's not currently implemented, but if you want to add error management, you must do it yourself each time. As a conclusion, I believe the sub makes sense for the restricted case when you merely want to check availability (you could add a timeout). Another big advantage is its declarativeness. If you want to actually display something and manage UX states, better to encapsulate the sub usage into a component. From that step, it's better not to follow re-frame sub-based approach but the reagent one.
- Loading branch information