The idea of a "pure" component is that its whole state is represented by its inputs, where all inputs are immutable. This is effectively a stateless component, but additionally, all the inputs are immutable.
I like to call such components "pure" because their behaviour can be compared to the concept of pure functions in functional programming. A pure function is a function which has the following properties:
- It does not rely on any state outside of the function scope
- It always behaves the same and returns the same result if input parameters don't change
- It never changes any state outside the function scope (side effect)
With pure components, we have a simple guarantee. A pure component will never change without its input parameters being changed. Sticking to this idea about components gives us several advantages. Besides having a complete...