svelte-legos icon indicating copy to clipboard operation
svelte-legos copied to clipboard

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

Open kevmodrome opened this issue 1 year ago • 5 comments

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 avatar Mar 09 '23 15:03 kevmodrome

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

kevmodrome avatar Mar 09 '23 15:03 kevmodrome

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

ankurrsinghal avatar Mar 09 '23 19:03 ankurrsinghal

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 avatar Mar 10 '23 12:03 ankurrsinghal

@kevmodrome let me know what you think.

ankurrsinghal avatar Mar 10 '23 12:03 ankurrsinghal

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 :)

kevmodrome avatar Mar 10 '23 13:03 kevmodrome