DEV Community

Discussion on: Dynamic Name React Component With Closure

Collapse
 
alvechy profile image
Alexander Vechy • Edited

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.

Collapse
 
parfectshot profile image
Paritosh

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.