Recoil: Hook naming somewhat confusing?

Created on 5 Sep 2020  ·  4Comments  ·  Source: facebookexperimental/Recoil

With regards to the naming of the hooks, they were - to begin with - a bit confusing. I might be wrong, but would it be better to have them names something like...

useRecoilState() all good, this is fine and matches with hooks nicely.
useRecoilValue() => useRecoilGet() or useRecoilGetState() Not too big a deal this one.
👇 this and ☝️ this would be nice to match useRecoilGetState() and useRecoilSetState()
useSetRecoilState() => useRecoilSetState() Essentially all Recoil hooks to be prefixed with useRecoil...()
useResetRecoilState() => useRecoilResetState() As above ☝️
useGotoRecoilSnapshot() => useRecoilGotoSnapshot() As above ☝️

These arent really huge deals, just some suggestions for consistency 🤷‍♂️

Most helpful comment

Thank you very much for the feedback on the hook naming. We do have some usability concerns on the current hook names and are in fact considering some rename proposals. But we don't want to be too disruptive in changing the interface so would only consider this after some priority features/fixes we are working on. We're actually considering removing the Recoil branding from the hooks. We'll be getting more feedback on this, but just not at this time, since we want to focus on some priority work and avoiding disruption. So, I'm going to close this issue for now. But, we are taking this feedback into consideration.

All 4 comments

I just started investigating Recoil (I love it), and to be honest, the first thing I noticed is the possible improvement of naming convention. I'll write down the same thing you've written, just in a more "expressive" way.

| current version | sugested version |
| ------------- | ------------- |
| useRecoilState | useRecoilState |
| useRecoilValue | useRecoilGetState |
| useSetRecoilState | useRecoilSetState |
| useResetRecoilState | useRecoilResetState |
| useGotoRecoilSnapshot | useRecoilGotoSnapshot |

I've just found this

@suren-atoyan thanks for linking, yes, an extension of that conversation it seems. Hoping the conversation continues.

Thank you very much for the feedback on the hook naming. We do have some usability concerns on the current hook names and are in fact considering some rename proposals. But we don't want to be too disruptive in changing the interface so would only consider this after some priority features/fixes we are working on. We're actually considering removing the Recoil branding from the hooks. We'll be getting more feedback on this, but just not at this time, since we want to focus on some priority work and avoiding disruption. So, I'm going to close this issue for now. But, we are taking this feedback into consideration.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tklepzig picture tklepzig  ·  3Comments

yuantongkang picture yuantongkang  ·  3Comments

robsoncezario picture robsoncezario  ·  3Comments

jamiebuilds picture jamiebuilds  ·  3Comments

jamiewinder picture jamiewinder  ·  3Comments