The Price of JS Frameworks and Async Await Functions Explained


Summary of my bookmarked links from Dec 4th, 2021

Links

  • Mind the cost of JS frameworks

    Frontend development heavily relies on Single-Page Application (SPA) frameworks, which offer convenience but come with drawbacks. Frameworks can hinder clarity and readability by encouraging excessive abstractions and providing complex APIs. Moreover, frameworks may duplicate native browser features and hinder accessibility by promoting the use of unnecessary wrapper elements. While frameworks have improved in terms of performance and bundle size, they still add overhead compared to vanilla JavaScript. To mitigate these issues, developers can prioritize tree-shaking, opt for compiled frameworks, be mindful of library sizes, and consider server-side rendering, lazy loading, and prefetching resources to improve the first interaction time. Ultimately, using frameworks should be a deliberate choice that considers the trade-offs and aims to deliver the best possible outcome.

  • The Problem with Returning Values from Async Await Functions

    This article explores the concept of async and await in JavaScript, which are syntactic sugars for promise nesting. It provides examples to demonstrate their usage and potential pitfalls. The author highlights that an async function always returns a promise, and explains how to properly extract the desired value using the `.then` method or by utilizing async/await itself. The article concludes by suggesting async/await as a better approach to handling promises. Readers interested in JavaScript concepts and best practices will find this article informative.