luisanton-io / recoil-nexus

MIT License
163 stars 13 forks source link

Suggestion: Replace `use` from the API names with `get` #1

Closed JohannesKlauss closed 3 years ago

JohannesKlauss commented 3 years ago

Having an API with names like useRecoilNexusValue in a react context implies that these functions are hooks.

Since this is trying to give access to recoil atoms outside of React components I think that the naming of the API is doubling the confusion.

It feels like one would use hooks outside of React which is not the case. It could also lead to the impression that hooks are available outside a React component tree, which is also not the case.

So my suggestion would be to rename use to get, since these aren't hooks.

This would also get rid of the es-lint warning altogether.

luisanton-io commented 3 years ago

Thanks! I may agree that it does make more sense to have get and set. At this point, however, I was wondering what could we name the function returning the tuple. Perhaps it could be ditched altogether?

This is your suggestion if I understand correctly:

import { getRecoil, setRecoil } from "recoil-nexus"
luisanton-io commented 3 years ago

Implemented in 0.1.5