4 ms·
Pontificating a little here, but it reminds me of "The road to hell is paved with good intentions" quote. Any external code that purports to be reusable should
by thomasfromcdnjs 5y ago
Pontificating a little here, but it reminds me of "The road to hell is paved with good intentions" quote.
Any external code that purports to be reusable should not be concerned with the idea of an "environment".
Positing that reducers should be pure is fine and dandy, telling me I can't throw in a side effect is none of your business.
Instead of running it twice, just make a warning log and be done with it.
- arcbyte 5y agoWith React, it's your code that is the external code. Your reason is quite sound. Your reducers shouldn't be concerned with any jind of "environment" or side effects.
- the8472 5y ago> Positing that reducers should be pure is fine and dandy, telling me I can't throw in a side effect is none of your business. API contracts work in both ways. The user has to uphold it just as much as the provider. If you don't breakage ensues. In lower-level languages this can include the nasal demons from UB.
- brundolf 5y agoIt can't log a warning because it can't actually detect side-effects. The only way to "detect" them is to push them to cause breakage in the app logic