Open
Description
There are some architectural issues with our current <AccessType>
component which I'm noting here: These issues made working with the component hard:
- on
componentDidMount
we're callinginitAccessType
which makes the subsequent calls likethis.getSubscription()
andthis.getPaymentOptions()
always happening if somehow the component is re-mounted. This is not needed as we should let the users of the component decide when to callinitAccessType
as we're exposing it through renderProp anyway. The component calling itself counter the full renderProp idea.
Note: when removing make sure the users of<AccessType>
are callinginitAccessType
explicitly when needed. - API calls like
this.getPaymentOptions()
should be cached in memory. - There should be more exposed helper functions like
setUser
andgetJWTToken
and try to memoize the results.