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.

https://romgrk.com/posts/optimizing-javascript

You probably don’t need eslint-config-prettier

https://www.joshuakgoldberg.com/blog/you-probably-dont-need-eslint-config-prettier-or-eslint-plugin-prettier/

Typescript: What’s the Point?!

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

https://www.epicweb.dev/typescript-what-s-the-point

Angular + Wiz

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

https://twitter.com/sarah_edo/status/1770478763253379488

There is no EU Cookie banner law

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

https://www.bitecode.dev/p/there-is-no-eu-cookie-banner-law

Using LocalStorage in Modern Applications

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

https://rxdb.info/articles/localstorage.html

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

https://heydonworks.com/article/offloading-javascript-with-custom-properties/

Good summary from Cory House about React State Libs

https://twitter.com/housecor/status/1768997355779428678

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

https://dbushell.com/2024/03/10/css-button-styles-you-might-not-know/

Vertical form controls

https://webkit.org/blog/15190/implementing-vertical-form-controls/

Mixed News

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

https://blog.pragmaticengineer.com/the-ai-developer/

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.

https://www.w3.org/TR/webnn/

Comment on Mastodon