Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks do not exist in Svelte, consider renaming these actions by removing the "use" part #8

Open
kevmodrome opened this issue Mar 9, 2023 · 5 comments

Comments

@kevmodrome
Copy link

Hooks do not exist in Svelte. They are a React feature. Please consider renaming all these by removing the use from the action name.

Compare: use:counter and use:useCounter.

@kevmodrome
Copy link
Author

See, I was even confused by the naming convention. I assumed all the useX were actions, but looks like they are stores. Call them what they are, custom stores, not hooks.

And for the actions, remove the action part of the name

@ankurrsinghal
Copy link
Owner

Thanks, @kevmodrome for the suggestions, totally makes sense.

@ankurrsinghal
Copy link
Owner

Resolved, I think we should preserve the type actionin the actions, used them as suffix rather than prefix, now they read as for example, use:draggableAction.

@ankurrsinghal
Copy link
Owner

@kevmodrome let me know what you think.

@kevmodrome
Copy link
Author

So - I think it's quite redundant to call them somethingSomethingAction - can I suggest maybe doing something like this:

For actions:
import { clickOutside } from 'svelte-legos/actions

and for the custom stores:
import { counter } from 'svelte-legos/stores

As soon as you use them in Svelte it's obvious what they are: use:x - it's an actions. $counter it's a store :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants