setState, reducers), state getters and render functions are in principle always pure. As a result, interaction handlers such as
onClickor lifecycle methods such as
componentDidMounthandle side-effects imperatively.
declarativeStorageSideEffectis pure while
imperativeSideEffectHandleris not. Every application will have imperative and impure code:
declarativeStorageSideEffectcan't exist without
imperativeStorageSideEffect. But it is best for imperative code to be isolated and as high as possible in your application.