Vitaly Friedman loves beautiful content and doesn’t like to give in easily. When he is not writing, he’s most probably running front-end & UX …
Every now and again we have to deal with legacy code, wading through dark and eerie sides of the code base, often with a vague, ambiguous and unsettling documentation — if any is provided at all. In such cases, refactoring the component seems inevitable.
30 Seconds Of Code
Micro-Libraries Under 5K
Single Line Of Code
Vanilla JS Code Challenge
If you still find yourself in the land of legacy systems running on jQuery, there is a number of resources that allow you to slowly move away from jQuery with more lightweight and standardized options:
Elijah summarized three different methods for dealing with time and dates. The
Finally, the generic method
toLocaleString lets you pass one or all of the options from the former ones into one method. Elijah built a CodeSandbox playground where you can experiment with the different approaches.
The deep knowledge of a subject really lies in understanding subtle differences between alternate ways of solving the same problem. How is
nodeName different from
tagName? How are the two increment operators different, e.g.
value++? is a friendly reference site for sorting out just this kind of questions.
Writing Clean, Reusable Code
Perf-Track tracks framework performance at scale. It basically tracks the performance in terms of Core Web Vitals for Angular, React, Vue, Polymer, Preact, Ember, Svelte and AMP — on mobile and on desktop. The data set is currently still from 2020, but it gives us some insights into how well sites with these frameworks perform in the wild. For example, React with Gatsby perform better than the ones created with Create React app.
Tim Kadlec also conducted some research around that, comparing jQuery, Vue.js, Angular and React. The end result: the current crop of frameworks isn’t doing enough to prioritize less powerful devices and help to close the gap between desktop and mobile. These figures might give you at least some context to make a more informed decision.
Standalone Vanilla JS Libraries
This content was originally published here.