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