In computer science and particularly in functional program a pure function has the following characteristics
- It does not change any objects or variables that existed before it was called
- Given the same inputs it always returns the same result
React is designed in a way that it assumes that every component is a pure function. Event handlers while defined inside components don't run during rendering so they need not be pure.
---
https://react.dev/learn/keeping-components-pure