Using anonymous functions as component props have become a kind of lazy go-to that threatens bloat at larger scale.
The issue is that when every time a button renders, a new anonymous function is created and held in memory causing potential performance issues.
This potential issue is often addressed by implementing individual components for each instance, so the pertinent data is isolated at only one instance.
A data attribute can still be used as an efficient and readable solution when it’s not feasible to have the update logic confined to a local scale.
The most comprehensive measure would be to always begin with code so well-modularized that the passing of key data is done through props right to that component.
The pattern of using anonymous functions is not a compatible way to write code with large scale.
The use of anonymous functions is acceptable when called in reactively or simplifying the passing of function params.
Instead of anonymous function approach, a better measure would be to make sure to create individual components for repetitive tasks, limiting complicated workflow.
The possibility of anonymous functions being handled by Svelte during transpilation exists, but best practices are still required to follow by builders.
This issue exists in most of the JS libraries, and it's imperative to equip good habits while coding to promote better practices.