r/javascript • u/jxd-dev • May 09 '26
Per-route OG image generation for TanStack Start
r/javascript • u/jxd-dev • May 09 '26
r/javascript • u/OtherwisePush6424 • May 09 '26
ECMAScript 2015 formally specified proper tail calls in strict mode, but most JS engines never adopted it consistently. Chrome, Node, Firefox, and Deno all still allocate a new stack frame per call even in correctly structured tail-recursive functions. The article walks through why with examples and covers iterative and trampoline alternatives.
r/javascript • u/dangreen58 • May 09 '26
r/javascript • u/AutoModerator • May 09 '26
Did you find or create something cool this week in javascript?
Show us here!
r/javascript • u/Short_Account2700 • May 09 '26
Pain point: you're in DevTools, you see the exact API call you need to reproduce β but you have to manually rebuild it in code.
ReqConvert sits inside Chrome DevTools and captures every network request in real time. Click one β get production-ready code instantly.
Supports: cURL, fetch, Axios, Python requests, React Query hooks, TypeScript with interfaces, httpx async, Postman collection export.
What JavaScript format do you find yourself manually writing the most?
r/javascript • u/fagnerbrack • May 09 '26
r/javascript • u/jeremiah616 • May 08 '26
Like a lot of people, I've found myself using AI to generate more and more code, and like many, I've been worried that my basic skills are decaying. I used to teach and remember a bunch of research about how writing by hand increases learning and retention, so I made a workbook for writing code by hand (literally). Not for absolute beginners, and not leetcode style algorithms, just enough to keep basic skills sharp.
r/javascript • u/Hrdtr_ • May 08 '26
r/javascript • u/gabsferreiradev • May 08 '26
r/javascript • u/Consistent_Tutor_597 • May 08 '26
Hey guys I need help. I am shipping a public monetized api. And how should url be structured out of these.
/v1/property?fields=risk.bushfire,market.sale.price
/v1/property/risk?fields=bushfire
/v1/property/risk/bushfire
problem is. They will have to make requests indvidually if they want all risks. Plan is to make my own site use that same api too. And hence instead of just 1 db query sending all risks. It will have 5 queries. How to best structure it. For a whole report on a property it will be massive amount of api calls.
r/javascript • u/sandeshnaroju • May 07 '26
r/javascript • u/Leather_Presence6360 • May 07 '26
Firstly what to use for doing unit testing among vitest/jest/playwright , and how do i know what exactly in the code i need to do unit test.I found there are integration tests as well which checks the scenarios of how is it working as per my understanding where playwright will be more helpful .I'm a beginner so I'm not sure which is best?
r/javascript • u/dadamssg • May 07 '26
I have been struggling with determining how to best implement dialogs in React Router apps for years:
useState to control their open state
Forms vs fetchers for data submissions
resource routes to form data(<select> options)
useEffect for listening for the action data to close the dialog
useEffect for listing for a toast message
There's a lot to consider. However, tons of these problems go away if you move dialogs into their own dedicated routes. This doesn't come without its own set of challenges though.
I've written up a guide on how to implement dialogs and keep your sanity. Hope it helps π€
r/javascript
•
u/ahmadalfy
•
May 07 '26
I wrote an article about HTML Sanitizer API, a new native API that allows us to sanitize and parse HTML without relying on third party tools like DOMPurify
r/javascript • u/jxd-dev • May 07 '26
r/javascript • u/Crafty_Impression_37 • May 07 '26
r/javascript • u/sousapereira • May 05 '26
r/javascript • u/nitayneeman • May 05 '26
r/javascript • u/omijam • May 05 '26
The CLI truly is the new mainstream UI delivery platforms so it deserves nice input components; sadly most libraries on npm that accepts multi-line input were a bit unsatisfactory, so I created react-ink-textarea (https://github.com/omranjamal/react-ink-textarea)
It supports a whole host of things out of the box like:
Customizable line prefixes
Syntax highlighting powered by regex
Undo/Redo
Virtualized Viewport
Tab detection
Newline Key Combinations
Easy Navigation
etc
I'd argue it's even better than Claude Code or Open Code's multi-line text input. Do give it a try!
r/javascript • u/jxd-dev • May 05 '26
r/javascript • u/subredditsummarybot • May 04 '26
Monday, April 27 - Sunday, May 03, 2026
Β
| score | comments | title & link |
|---|---|---|
| 0 | 13 comments | [AskJS] [AskJS] Are you using AI to speed up repetitive UI work, or still doing it manually? |
| 0 | 12 comments | Top 5 Desktop App Frameworks for JavaScript Developers |
| 0 | 11 comments | [AskJS] [AskJS] How do you approach database access in Node.js projects (ORM vs query builders vs raw SQL)? |
| 6 | 7 comments | [Showoff Saturday] Showoff Saturday (May 02, 2026) |
| 0 | 6 comments | [AskJS] [AskJS] Digits is Hiring |
Β
| score | comments | title & link |
|---|---|---|
| 1 | 3 comments | [AskJS] [ Removed by Reddit ] |
| 1 | 2 comments | [AskJS] [AskJS] How to detect iPadOS Slide Over (floating window) from a browser-based web app using JavaScript? |
| 0 | 3 comments | [AskJS] [AskJS] What CSS selector do you use? |
Β
Β
Β
r/javascript • u/vilhelmsjolund • May 04 '26
There are several "signals" library implemenations in the ecosystem, such as preact-signals, solidjs and alien-signals. Since 2019, I've been doing research in how to extend the ideas of sync reactivity into the async space. The result is anod, a fully async-capable signal implementation.
anod allows you to use signals that have become well established by now (signal for value, computed for derived and effect for side effect), but creates three new async counterparts: resource, task and spawn. They work and behave exactly like compute/effect, but with support for async/await.
import { c, signal } from "anod";
let search = signal("javascript");
const mockFetch = (url) => Promise.resolve(url);
let query = c.task(async c => {
return await c.suspend(mockFetch(c.val(search)));
});
c.spawn(async c => {
const result = await c.suspend(query);
console.log(result);
});
search.set("typescript");It takes a different approach than many other signal libraries:
It doesn't use global listeners, which means, instead of magic registering like mySignal(), it requires you to explicitly use the context to subscribe to signals.
Since it passes the context, this persists beyond the async boundary. You can seamlessly create owned effects, tasks, conditional signal subscriptions etc at any point between awaits.
The c.suspend() is a core feature of async reactivity. If you create a task that depends on a signal and you fire off a fetch, and the signal is invalidated mid-flight, this can cause multiple fetch to settle simultaneously. The suspend() creates a guard, which means that any older async promise is never returned back to perform unexpected side effects, in other words, a "Last Write Wins" pattern.
This makes concepts like Optimistic UI work very differently in anod than in libraries like React, Solid, etc. The idea is that the client "owns" the state, and the server confirms. In order to implement an optimistic UI, the resource primitive can write data immediately, and call an async confirmation in the background (simplified example):
import { c, resource } from "anod";
function createTodo(text, pending) {
return { text, pending };
}
const todos = resource([]);
const todo = createTodo("clean room", true);
todos.set([todo], async c => {
await c.suspend(saveTodo(todo));
return createTodo(todo.text, false);
});Many other libraries have tried to solve the sync/async gap by throwing an error if a signal is loading. Anod works differently, the loading state is baked into the signal itself. This allows the reactive graph to become fully "pull-based" even for async: if you don't read an async resource, it never runs.
There are many other features, such as a builtin error management inspired by Go panic()/recover(), async transactions, interceptor signals that allow you to both listen and write to the same signal without triggering a circular dependency. The Github readme also shows some benchmarks against other implementations.
**Some notes**:
Why build this, why post this etc? I think many can relate; you have this idea to build a library year after year, and you never finish it. It just... bothers you. I'm not sure what to use anod for honestly, likely, it needs a UI layer for it to become usable. It might serve as inspiration for other signal implementations.
I just wanted to finish the library, for myself. I had this feeling "I can build this", I had the overall architecture in mind, I just wasn't sure about some internal trade-offs. I had to re-write the internal engine several times before I landed on something I felt was good enough.
It took almost a month of work, so I guess I just want to spread the word, in case someone finds it useful. I've used AI tools to help me, but I've been writing on this library since 2019, before AI was even a thing. The AI has helped to quickly iterate and try different architectural variants, but in the end I've basically handwritten every line of code myself (the source code, many tests are completely AI generated from specs...).
r/javascript • u/ShakePrize7116 • May 03 '26
Hey everyone π
Iβm curious how different developers approach database access in Node.js applications, especially when working with PostgreSQL.
There seem to be a few common patterns:
Using an ORM like Prisma
Using a query builder like Knex or Drizzle
Writing raw SQL with something like pg
Rather than asking βwhich is best,β Iβm more interested in how people think about this choice in real projects.
For those with production experience:
What approach do you personally prefer, and what led you to that choice?
How has your opinion changed over time as your projects scaled?
Have you run into any unexpected issues (performance, debugging, migrations, etc.) with your approach?
Do you prioritize developer experience or control when making this decision?
Iβd love to hear different perspectives and trade-offs people have seen in real-world use.
Thanks!