So in theory, that would be fine as well. In reality though, the categories aren't coarse like "electronic component", they're more like "resistor, 10K, 1/4W, carbon film".
From this article [1] published by the European Commission:
> The 3 € fee is applied per declared item, where ‘item’ means each unit of a product that is declared on a separate line. Specifically, the Commission defines "item" as one or more goods in a consignment sharing the same tariff classification, description and, where applicable, origin.
Now, the type of declaration matters [2] - if you're filling an H1 (standard customs) then you pay per item but if you're filling an H6 (postal declaration) or an H7 (Courier or low-value consignment declaration) then you pay per category. So anyone saying that it's always one or the other is, at the very least, oversimplifying.