Hacker News new | ask | show | jobs
by nightnight 2425 days ago
@Dan, fyi, useTransition is already used as a hook name by the quite popular react-spring animation lib. I mean, I can migrate old code bases to import { useTransition as useSpringTransition } or I just import yours as { useTransition as useReactTransition }.

Not a big thing but also not really elegant. How would you deal with this?

1 comments

Yeah that’s kind of unfortunate. Unintentional. I think one of us will have to rename.
You only have to rename if people import each hook separately.

I prefer to use React.useWhatever(); so I don’t have to keep going to the top of the file and importing new things.

Is my preference wrong? Much of the code that I see online does not use my preference...