Svelte - Technological watch
Introduction
Svelte, a JavaScript framework for constructing UI components, operates similarly to React, Angular, or Vue. However, it distinguishes itself by functioning as a compiler rather than relying on a Virtual DOM like its counterparts.
In essence, Svelte transpiles declarative code into JavaScript that seamlessly integrates with web browsers. The result is a generation of high-performance code delivered in a compact package.
How it works
To create a Svelte component, you need to create a .svelte
file like this.
And of course you can use Typescript or SASS with it.
You can use conditional rendering, loops, and other stuff !
- Conditional rendering:
- Loops:
- Await:
Using components
You can create a component, and use it:
And then use this component like this:
(Demo here: https://svelte.dev/examples/declaring-props)
Stores
You can save global variables in Svelte stores.
$
means “subscribe” to a store. If the value changes, the component re-renders.
(doc: https://svelte.dev/docs/svelte-store)
Advantages
- Easy to write code, Svelte is logical. Less code = less problems. 💡
- Svelte is lightweight. 🌠
- Svelte is performant, no VirtualDOM to care about ! The output code works well on smaller configuration. No need to import a BIG library like React or Vue to load the interface. 🚀⚡
Disadvantages
- The community is smaller. There is a smaller open-source ecosystem. But Svelte popularity is growing up every year. (https://2022.stateofjs.com/en-US/libraries/)
- Svelte is an abstraction of Javascript. You won’t play with
.js
files. So you need to download extensions and setup the project before using. - Not too much Job opportunities with Svelte yet.
Atomic design - Technological watch
Learn what is the atomic design in less than 5 minutes !
Redis - Technological watch
Learn what is Redis in less than 5 minutes !
Jenkins - Technological watch
Learn what is Jenkins in less than 5 minutes !
PicoCSS - Technological watch
Learn what is PicoCSS in less than 5 minutes !
OpenAPI / Swagger - Technological watch
Learn what is OpenAPI / Swagger in less than 5 minutes !
HashiCorp Vault - Technological watch
Learn what is HashiCorp Vault in less than 5 minutes !
RabbitMQ - Technological watch
Learn what is RabbitMQ in less than 5 minutes !
Falco - Technological watch
Learn how to protect your Kubernetes cluster in less than 5 minutes !