Web development
fromInfoWorld
1 day agoHTMX 4.0: Hypermedia finds a new gear
HTMX 4.0 replaces XHR with the Fetch API, enhancing performance and developer experience in web development.
Before: Developers installed node-fetch to use the familiar browser fetch() API in Node.js. Now: Starting in Node.js 18, fetch() is a global function, identical to the browser implementation. const res = await fetch('https://api.github.com/repos/nodejs/node'); const data = await res.json(); console.log(data.full_name); // "nodejs/node" When added: Introduced in Node.js v17.5.0 (experimental) Stabilized: Became stable (no longer experimental) in Node.js v18.0.0 When to still use node-fetch: Only if you need older Node.js compatibility (pre-18).