4 ms·
A global initializeLaunch is a deal breaker. Services should be passed a provider (similar to Redux). Having state stored globally can cause many issues: - Te
by CraftThatBlock 6y ago
A global initializeLaunch is a deal breaker.
Services should be passed a provider (similar to Redux). Having state stored globally can cause many issues:
- Testing is harder, as the state can be shared
- Having sub-stores is impossible
- Having parallel stores is impossible
- jbillmann 6y agoThanks for the feedback! As noted in my blog post, these types of tradeoffs were consciously made to simplify other aspects React state management. If, for example, sub-stores and/or parallel stores are important, Launch.IO might not be a good choice.
- CraftThatBlock 6y agoI don't see this as a large tradeoff. Taking from your example and modifying to follow good practices: const launch = initializeLaunch(/* ... */); const App = () => { // ... return ( <LaunchProvider launch={launch}> <div>...</div> </LaunchProvider> ); };