/dropin-svelte

Svelte """Hooks"""

MIT LicenseMIT

dropin-svelte

Svelte """Hooks"""

Examples of how to achieve drop-in functionality with Svelte. Something like React Hooks. Should be easy to use - just drop into any of your components.

Whether the same level of composability as React Hooks can be achieved easily is an open question (to me, at least). Examples may or may not endeavor to be composable. See https://github.com/ryanatkn/assorted-svelte-tidbits/blob/master/tidbits/composing-svelte-stores-vs-react-hooks.md

Avoid examples which involve proper nouns like Redux or Firebase, and/or which seem to solve React-specific problems (forms, etc).

Click Outside

Perform action when user clicks outside of component.

Implementations:

todo

Media Query

e.g. simply isScreenWide?

Implementations:

Fetch with isLoading

Just Fetch which tells you if it's loading.

Implementations:

todo

Mouse Position

Track mouse position.

Implementations:

Swipeable

Like https://github.com/dogfessional/react-swipeable

Implementations:

todo

Localstorage

Easily store something in localstorage.

Implementations:

See https://twitter.com/Rich_Harris/status/1126688034223579140

Clipboard

Read and write to user's clipboard.

Implementations:

todo

Scroll Position.

e.g., update navigation header based on. Like https://github.com/Purii/react-use-scrollspy

Implementations:

todo

State with undo/redo

Like https://github.com/xxhomey19/use-undo

Implementations:

todo

Timer

Timer with start, stop, pause, reset

Implementations:

todo

Idle tracker

Tracks if user is idle

Implementations:

todo

Log lifecycle

Logs during component's lifecycle methods

Implementations:

Debounce function

Create a debounced version of a function. Like https://github.com/streamich/react-use/blob/master/docs/useDebounce.md

Implementations:

todo