Friday Issue Nr. 105 | 22/03/2024

Excellent post on JS optimisation, Why Typescript, Angular + Wiz, EU and Cookies, use of LocalStorage, React State libraries and W3C work on Neural Network API.

JavaScript News

Optimising Javascript

Excellent post with many examples and a detailed explanation of how to keep your code fast. There is no cheating on Big O; unfortunately, the functional approach is not the fastest in JavaScript. That doesn’t mean we need to rewrite every map() with a loop, but it is good to know the difference.

You probably don’t need eslint-config-prettier

Typescript: What’s the Point?!

Nice without-hype post on the reasoning for using TS.

Angular + Wiz

Angular announce merge with Wiz (Google’s internal framework)

There is no EU Cookie banner law

A different perspective on cookie banners, or apparently myth about forced from EU cookie banners.

Using LocalStorage in Modern Applications

Excellent summary of when to use, not to use and what to use instead of LocalStorage.

An excellent example of how to leverage custom CSS props in JS

Good summary from Cory House about React State Libs

There are many React state libraries, so it’s hard to choose between them.

Think in categories. Many are similar. Six categories:

1. Route state Tanstack router loaders, Next.js RSC fetch results - Data is fetched and cached when a route loads.

2. Remote state Tanstack query, swr, RTK Query, Apollo - Data is fetched and cached when a component loads.

3. Atomic Recoil, Jotai - Mutable stores (called “atoms”) can be composed. Optimise renders via atom dependency (Jotai), or via string key (Recoil). State is inside React.

4. Unidirectional Redux, Zustand - Immutable store. Dispatch actions to change data. Optimise renders via selectors. State is outside React.

5. Proxy Mobx, Valtio - Mutable state. Wrap your state in a proxy, so renders are automatically optimised. Valtio uses a hook. Mobx uses an HOC. State is inside React.

6. State machine XState - Enforce state transition rules, and visualise state via state charts. State is outside React.

CSS News

CSS button styles

Vertical form controls

Mixed News

Is the “AI developer” a threat to jobs – or a marketing stunt?

Web Neural Network API

This API would define an ML abstraction layer without being tied to platform-specific capabilities. There are loads of use cases, such as face recognition, semantic segmentation, text-to-image, emotional analysis, and speech recognition, to name a few.

Comment on Mastodon