Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
react-gradual-upgrade-demo
Demonstration of how to gradually upgrade an app to a new version of React
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
> React and Vue [...] exist so that you write your application in a declarative way where the view is rendered as a function of state
Exactly. To elaborate, here's the big, big caveat in a miniature form:
https://github.com/1Marc/todomvc-vanillajs-2022/blob/854dd40...
Note that this clears and recreates the DOM on every action (eg mark complete), and DOM ops are the most expensive ones. This is a sound strategy for vanilla JS, because the alternative is mutating the DOM and keeping it in sync which is error prone to put it mildly.
I use frameworks very sparingly, and am always cautious with deps. But a reactive UI/diff engine is non-negotiable for me.
The event listeners get cleaned up by the GC. At least in modern browsers.
While events aren’t explicitly mentioned, MDN offers an insightful read:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memo...
Alternately, one can use event delegation [0]. As does React under the hood [1].
0 - https://javascript.info/event-delegation
1 - https://reactjs.org/blog/2020/08/10/react-v17-rc.html#change...