When I try to learn something, I search around for the optimal approach. In the case of hooks I found two reasonable approaches and one approach that only makes sense in some use-cases. Below I've documented all of them.
I want to change the style of a text element when the user is clicking down on it. Because this is React Native for web, there are no CSS pseudo classes, so I need to manage all of the state myself. Because classes like active
, focus
, hover
, and visited
could be commonly used the API must be very self-contained.
... and I want people to like me, so I'm using hooks (the old implementation used render props).