Closed marvinhagemeister closed 4 years ago
I mostly agree with this change, though it does cause memoization to fail, which can have unfortunate impacts on diff performance. I wonder if we should just downgrade this to a warning?
I do use inline handlers all the time, so I end up just ignoring the warnings from this rule, which is probably silly.
While we can ignore warnings, I think it's much more confusing for newcomers who may not understand why the warning is there in the first place. Memoization can be a problem and in the code-bases I've seen use memoization explicitly (via useMemo
) or something else.
This PR loosens the rule regarding inline functions for event handlers. Personally I've found that the difference is hardly measurable on any devices I own. Plus in Preact's case we just swap an object pointer during diff.