I write all my newsletters using Kit โ, my favorite newsletter platform.
Subscribe to the newsletter
Get the latest updates delivered directly to your inbox.
I write all my newsletters using Kit โ, my favorite newsletter platform.
Get the latest updates delivered directly to your inbox.
Hey friend,
Today we will talk about Promises ๐ค. But first, let's understand what a promise is. A promise has 3 states: pending, fulfilled, and rejected. Here is the breakdown
When a promise is returned, it could be any of the above values.
Let's review our weekly snack ๐
What if there are several promises that we want to resolve? Well, then we might have heard of `Promise.all`.
Promise.all will allow us to invoke all promises in the form of an array and will return an array of resolved values.
But wait, hold on. There is a catch here. If one of the promises is rejected, then all of a sudden, the entire Promise chain is rejected. This is not usually what we want, as we still want our app to function as expected and don't want it to stop working if one thing doesn't work.
So how can we solve this problem? ๐ค
Promise.allSettled will also return the resolved as well as rejected values of the promises unlike Promise.all. In case, one promise gets rejected, we will still get the resolved values of other promises. This way, our app will continue to function.
โIntroducing Svelte 1.0: A new version of Svelte is out. It's a framework used to build apps with server-side rendering but does things differently. Svelte is built on top of Vite.
โSWR 2.0 by Vercel: SWR 2.0 is out. SWR is a popular React data-fetching library that enables components to fetch, cache, and mutate data. SWR 2.0 makes it better by providing ease of use, additional hooks, and more optimizations to make it easier to fetch data.
โVite 4.0 is out: Vite 4.0 is finally out and has exciting changes. We already saw Nuxt and Astro built on top of Vite.
Have a wonderful day!