The problem with the hook approach is that you actually don't solve any problem. Performance-wise DropdownElement written as component is parsed by the engine once, while inside the hook function for DropdownComponent is allocated on every hook call. While ofc the effect is very little, there is no benefit that can out-weight the loss.
The problem with the hook approach is that you actually don't solve any problem. Performance-wise
DropdownElementwritten as component is parsed by the engine once, while inside the hook function forDropdownComponentis allocated on every hook call. While ofc the effect is very little, there is no benefit that can out-weight the loss.Exactly! Writing custom hooks just for readability while compromising with the performance is not a good approach.
I would've loved if there was some actual problem-solving in this post.