jeddeloh / rescript-apollo-client

ReScript bindings for the Apollo Client ecosystem
MIT License
126 stars 18 forks source link

Why records instead of Variants? #76

Closed a-c-sreedhar-reddy closed 3 years ago

a-c-sreedhar-reddy commented 3 years ago

Hi,

Any reason why the use function returns records instead of variants?

jeddeloh commented 3 years ago

Some of us found them to be a bit of a trap. You can see the discussion in the original reason-apollo-hooks PR here: https://github.com/reasonml-community/reason-apollo-hooks/pull/122#issuecomment-633560391

jfrolich commented 3 years ago

Mostly because the state was not always mutually exclusive - like it can be (re)loading and have data - so you would end up with a lot of variants. A product type is better for this, and we can pattern match on it as well.