Загрузка страницы

Custom Svelte Store: Higher Order Store

Custom Svelte Store: Higher Order Store

---
In this video, I am going to show how to use functional programming concept, higher-order functions into Svelte stores. And I am calling it, higher-order store.

Higher order store is a function that takes in a store as an argument, and returns a new store. The returned store is derived from the input store, but with enhanced abilities.

For example, a `throttled` higher-order store takes in a store and returns a `throttled` version of the store. The store value is updated in a throttled manner.

Writing the `throttle` logic as a higher-order store allow us to easily reuse it, by applying `throttle` to any store that we want to throttle.

In the video, I've shown other examples of higher-order store, such as:
- throttle
- debounce
- readonly
- spring
---

💻 REPL: https://svelte.dev/repl/01959ea307cc4ed4aadfd251967ef4a2

📚 Related Resources
DOM Events as Svelte Store https://youtu.be/Aq-hZhX2vfU
tweened() Svelte store https://youtu.be/I5dEo7HL1LY
The Difference Between Debounce and Throttling https://css-tricks.com/the-difference-between-throttling-and-debouncing/
Higher Order Functions https://medium.com/javascript-scene/higher-order-functions-composing-software-5365cf2cbe99

🥰 Support me https://www.buymeacoffee.com/lihautan

🔗 Want to learn more from me? Check out these links:

Twitter: https://twitter.com/lihautan
Blog: https://lihautan.com/
Newsletter: https://lihautan.com/newsletter

#svelte #sveltestore

Thanks for watching 🥰 -- with love, Li Hau

Видео Custom Svelte Store: Higher Order Store канала lihautan
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
21 февраля 2021 г. 9:07:43
00:29:43
Яндекс.Метрика