r/reactjs 7h ago

Show /r/reactjs Ambient CSS v3 - Blender meets CSS

Thumbnail
ambientcss.vercel.app
27 Upvotes

I started building a physically based shadow system for CSS 5 years back and gave up after it became too complex. Then, leveraging coding agents, I was finally able to ship v1 earlier this year. Thanks to the very kind and warm reception for v1 from the members of this community and r/css , I was motivated to develop it further.

Today, I'm announcing Ambient CSS v3. This version steps up the realism considerably - each effect and base component was first built in Blender and rendered using an identical lighting setup. Then, based on the renders the CSS formulae were adjusted to match the Blender render. All the Blender files and their parametric generators are also in the source repo.

Besides this, we also have new CSS modifiers - thickness, material (matte/shiny/glass/brushed/spun/blasted). We also have some new components for the react package. Also, the component system is refactored and split into base components and skins, allowing for the ability to create custom component kits.

Thanks for your love!


r/reactjs 8h ago

What would make a component unmount on some parent renders but not others when the key isn't changing?

3 Upvotes

I've got a filter panel in a Vite app on React 18 where the date inputs wipe themselves maybe one time in five when the parent list refetches. I've ruled out the usual cause, the child isn't declared inside the parent's render body, and the key I pass it is a stable string. I put a log in the child's mount effect and it fires every time the fields clear, so it's actually remounting rather than losing state some other way. I've been on this about three hours and I can't work out what's different about the renders where it happens.


r/reactjs 13h ago

How do you decide when a piece of state actually belongs in global state vs. just lifted up a few components?

3 Upvotes

I feel like this decision gets made almost by accident on a lot of teams — either everything ends up in Redux/Zustand/Context out of habit, or nothing does and you end up prop-drilling through five components to pass a single boolean. The rule of thumb I've seen most often is "if more than 2-3 components that aren't directly related need it, lift it to global," but that always feels a bit fuzzy in practice. Do you have an actual heuristic you use, or is it more of a gut call that gets refactored later once the pain shows up? Also curious how people handle the in-between case — state that's shared by a meaningful chunk of the tree but is really more "feature-local" than "app-global," where a full global store feels like overkill but prop drilling is annoying.


r/reactjs 1d ago

I created ascii/cnlibs - an ascii shadcn/ui component library

Thumbnail
ascii.cnlibs.com
42 Upvotes

r/reactjs 1d ago

Needs Help What does "rendering in background" in startTransition really mean?

21 Upvotes

So far, I understand that wrapping a function with startTransition tells React to treat it as a non‑urgent update. So if any urgent action occurs, React can respond to it immediately without blocking.

But here is where I got stuck. The docs say:

“useTransition is a React Hook that lets you render a part of the UI in the background.”

“The function passed to startTransition is called the Action. You can update state and (optionally) perform side effects within an Action, and the work will be done in the background without blocking user interactions.”

I don’t really get what “in the background” really means.

Looking at the example, I don’t understand why, with startTransition, the “Total” only renders once with the final "Total" after clicking “quantity” multiple times, instead of updating multiple times according to the number of times the “quantity” was clicked

Does “run in background” prevent multiple renders and only show the final result??


r/reactjs 1d ago

Needs Help Can anyone clarify the concept of "reusable state" in Concurrent React?

26 Upvotes

I’m reading the React docs, but I find this passage confusing. Could someone explain it to me?

"Another example is reusable state. Concurrent React can remove sections of the UI from the screen, then add them back later while reusing the previous state. For example, when a user tabs away from a screen and back, React should be able to restore the previous screen in the same state it was in before."

React docs link


r/reactjs 1d ago

Needs Help I built a dev tool that shows mobile, tablet, and desktop simultaneously in your browser: synced scroll, click, and input across all three

3 Upvotes

Been using Responsively App for a while but the context

switching was getting to me — separate window, separate

process, alt-tab constantly.

Built responsive-dx to solve it. It's an npm dev dependency

that injects a synchronized multi-viewport panel directly

into your localhost.

One command to set it up:

npx responsive-dx init

It detects your framework automatically (Next.js, Vite,

Remix, Astro, Gatsby) and adds the component to your layout

file. Nothing to configure manually.

What it does:

- Mobile, tablet, and desktop frames side-by-side

- Scroll one → they all scroll (real DOM sync, not emulation)

- Click syncs, input syncs, dark/light theme syncs

- Focus mode: one click to zoom any single frame

- iPhone notch on mobile, macOS chrome on desktop

The frames load any localhost URL — so even though the

wrapper is React, it works for Vue, Svelte, Angular, Rails,

Django, whatever you're running locally.

Zero dependencies. Tree-shaken out of production builds

completely.

GitHub: https://github.com/respodx/respo

npm: https://www.npmjs.com/package/responsive-dx

Happy to answer any technical questions.


r/reactjs 1d ago

Show /r/reactjs I built a streaming Markdown renderer for React that caches code lines, table rows and list items — benchmarks are surprisingly good

2 Upvotes

I’ve been working on an AI harness called Æven, and one of the things that kept bothering me was Markdown rendering during long streamed responses.

A lot of renderers optimize at the document or top-level block level. That works well for normal prose, but it gets expensive when the active block itself becomes huge — for example a long code fence or a large Markdown table.

So I built HyperMarkdown.

The main idea is pretty simple:

once a code line, table row or list item is settled, it stays cached. Only the changing frontier keeps being parsed/rendered.

That seems to make a pretty significant difference.

Current benchmark results:

  • Large code block: 190 ms vs 711 ms for the next closest streaming renderer
  • Captured real AI code stream: 611 ms vs 4.2 s
  • Captured real AI table stream: 668 ms vs 5.0 s
  • Large table: 999 ms vs 9.1 s for the next closest renderer

The benchmark runs production React and measures the full chunk → write → render/commit path, not just parsing.

I’ve compared it against:

  • markstream-react
  • Streamdown
  • DeepSeek Harness’ incremental strategy
  • react-markdown
  • markdown-it as a baseline

The repo includes the benchmark methodology, raw results and correctness tests, so I’d genuinely appreciate people trying to break the assumptions or point out unfair comparisons.

It also supports GFM, reasoning blocks, syntax highlighting, KaTeX, Mermaid, raw HTML sanitization, React 18/19, and streaming incomplete Markdown.

It’s now the renderer I use inside Æven.

Demo:
https://aeven-ai.github.io/HyperMarkdown/

GitHub:
https://github.com/Aeven-AI/HyperMarkdown

NPM:
https://www.npmjs.com/package/@aeven-ai/hypermarkdown

Would especially love feedback from people who have dealt with long streamed code blocks/tables in React apps.


r/reactjs 1d ago

I’m building an open-source Canvas-based document editor with a React adapter

9 Upvotes

Hey r/reactjs,

I've been working on Oasis Editor, an open-source TypeScript document editor with its own Canvas-based rendering engine.

React sits on top as an adapter rather than owning the editor runtime, so the same core can be used from vanilla JS, Vue, or headless environments.

The editor handles paged layout, text rendering, selections, images, tables, and document geometry through its own rendering pipeline, and exposes a typed command/plugin API.

Live playground:
https://celsowm.github.io/oasis-editor/#/editor

GitHub:
https://github.com/celsowm/oasis-editor

I'd love feedback on the React integration, API design, and overall architectu


r/reactjs 2d ago

Needs Help How would you handle uploading to a presigned upload URL, on paste, getting a download URL back and immediately displaying it in an input? (In S3)

14 Upvotes

I want in my practice chat app to be able to paste an image into a text input and be able to send it, on how to actually do this, I am unsure

My idea is this given a text input:

- a user could Ctrl-V (i.e., paste) something from his clipboard (a file in this instance), until a download url is returned (see below) there will be some loader spinner thingy
- In the backend is requested an Upload URL
- (somehow) whatever they pasted is immediately uploaded, likely by the path? But I am still a little bit unsure on that part
- a Download URL is returned on that S3 upload (SOMEHOW)
And thus you replace that temporary spinner with the download URL and the person can send it.

This is at least my idea on how you should be able to upload a piece of media in a message and be able to send it, I don't want just message attachments, that would be an easier story because once the association is made between the message and attachment you display it. I want something like in forums where the image can be embedded anywhere,

There is also one more small concern, on slow connection do you want to wait for the file to finish uploading first and then allow the user to send their message, or just send the message and let the upload come later, if the latter, how would you go across with doing that!?

The issue is, I have no idea on how to do this, I gave my approach above, I would really appreciate it if you guys gave some advice on what your approach would be and secondly, how to implement it, I already can get a presigned URL so that's not an issue

This is more of a design question, but it's also really interlinked with react so sorry if this is the wrong place to ask! ;-;

That's all :)


r/reactjs 2d ago

Resource Static Analysis for the Age of AI Slop

25 Upvotes

I recently wrote a blog post on how we can improve our static analysis using linting, custom rules, and hooks, all using oxlint.

It's quite a big article btw.

https://saybackend.com/blog/lint-ai-generated-code/


r/reactjs 1d ago

Needs Help I tried removing translation keys from React i18n — Zintl is now in alpha

0 Upvotes

I've always found translation keys a little strange.

You start with something perfectly readable:

tsx <button>Delete account</button>

Then i18n turns it into something like:

tsx <button>{t("settings.account.delete")}</button>

Now the source code, translation keys, and translation files all have to stay synchronized.

So I tried a different approach with Zintl:

What if the source string itself could be the thing the localization system knows about?

With Zintl, you keep writing normal application code:

tsx <h1>Welcome back</h1> <p>Your account is ready.</p> <button>Continue</button>

Zintl's compiler discovers the localizable strings and builds the localization layer around them.

The goal is that adding i18n shouldn't mean rewriting your application around t() calls.

It's currently alpha, so I'm very much not claiming this is production-ready.

I'm looking for React developers who have actually dealt with i18n to try it and tell me where this approach falls apart.

Especially interested in:

  • translation key management
  • dynamic/interpolated strings
  • component boundaries
  • pluralization
  • large applications
  • translation workflows/TMS
  • anything you think a compiler like this should handle

Docs: https://zintljs.github.io/zintl/en

I'd genuinely love the criticism. If you think the whole idea is flawed, tell me why.


r/reactjs 2d ago

Resource IconMind: 2,271 MIT icons for AI-era apps (agents, MCP, RAG) as tree-shakable React components — 1 kB gz per icon

0 Upvotes

One icon = one import = ~1.1 kB gzipped (import { AgentRun } from "@iconmind/react/icons/agent-run"), sideEffects: false, every icon its own entry so React.lazy has something to load. Outline and duotone, three weights, strokeWidth/absoluteStrokeWidth props. The AI vocabulary is the point — the generalist families are there so you don't need Lucide beside it (and a hundred Lucide names resolve as aliases if you do). MCP server for your assistant: npx u/iconmind/mcp. https://iconmind.dev


r/reactjs 2d ago

Discussion I built a React UI library with two install models. Does this split make sense?

Thumbnail
youtu.be
0 Upvotes

I read the recent thread here about what would make people try another React component library. A few answers stuck with me, especially composability, accessibility, and components that hold up outside of demo data.

I've been building Honest UI, and there is one decision I keep going back and forth on.

UI components and animated components get copied into your project. Once they're there, they're just source files. You can change the markup, behavior, variants, or styling however you want.

Charts, icons, logos, vectors, and shaders stay package imports.

My thinking is that application UI usually becomes product code pretty fast. A button or form field rarely stays generic once you start adding validation, permissions, loading states, weird content, and all the edge cases that show up later.

Charts and shaders feel different to me. They bring more rendering code and dependencies with them, and I would rather maintain that in one package. Copying a huge icon or logo collection into every project also seems unnecessary.

The part I'm unsure about is whether this split is useful or if it just makes the library harder to explain.

I made a short demo showing both approaches with real components.

Does this boundary make sense to you? Would you split it somewhere else?

If you think the whole idea is backwards, I want to hear that too.


r/reactjs 2d ago

Show /r/reactjs StyleX merges cross-module styles at runtime because it can't see the call sites. I scan them all instead.

0 Upvotes

StyleX built a world where the compiler and runtime solve everything together.
I scan everything and close the world at build time.

The syntax is close to StyleX, so StyleX users should feel at home.

  • Function keys (handles unbounded combinations)
  • Bracket variants (statically compiled, no combinatorial explosion)
  • Boundaries (styles can be bucketed through component props, once)
  • Cross-module (a graph and specificity management, so it doesn't live in the cascade)

No runtime evaluation: values that can't be enumerated at build time are a compile error, not a fallback.

  • css.create
  • css.createTheme
  • css.createStatic
  • css.keyframes
  • css.viewTransition
  • css.marker & css.extended
  • css.use & classStyle

Plumeria - Introduction


r/reactjs 4d ago

Resource I built a free deep-dive tutorial on React Internals (Fiber, Hydration, Event Loop, etc.) for everyone who wants to know how things actually work under the hood.

36 Upvotes

Hey everyone,

If you’re a frontend engineer who has been using React for a while, you’ve probably had moments where you know how to use a feature, but you still have a lingering gap in understanding why it works.

I kept running into these same burning questions:

  1. "React pauses and resumes work." - Wait, what does that actually mean? What are the exact mechanisms behind this?
  2. useState & useEffect - We all know the do's and don'ts, but sometimes it feels hard to truly internalize how they operate behind the scenes.
  3. The Fiber Tree - I've seen the conference talks, but what actually is it? How is it built, and how does it drive React?
  4. useLayoutEffect - How, when, and why exactly?
  5. The Event Loop -Tying React's execution (macro vs. micro tasks) back to Jake Archibald's famous event loop talk from years ago.
  6. Suspense - It's great for loading states, but how does React know exactly when the data is ready to swap out the loaders?
  7. Optimization - useMemo, useCallback, and React.memo cache things, but what’s the actual engine behind them?
  8. Hydration - The classic "breathing life into HTML" metaphor - but what is the actual code doing to make this magic happen?
  9. The Rendering Pipeline - How exactly does React hook into the browser's rendering steps?
  10. Custom Hooks - We write them daily and get asked about them in interviews, but what happens under the hood? How does React actually wire them up to our components?

There are plenty of other concepts, but if these questions ever keep you up at night, I have some good news. I finally sat down and put together a comprehensive tutorial that answers all of them and demystifies the "black box" of React.

Link: https://arpitjsoni.com/react-internals

Price: It’s 100% free. If you find it genuinely helpful, taking a second to like or retweet my pinned post on Twitter would mean the world to me, but otherwise, just enjoy the read!

P.S: I’m not super active on Reddit, so I likely won't be checking my DMs here, but I hope this helps some of you out!


r/reactjs 3d ago

Show /r/reactjs App.tsx as a user flow graph

0 Upvotes

Quick observation from working with React for a little while.

If you're working on a React app with React Router, your App.tsx (or wherever you define your routes) is already a flow graph. Each Route is a node. Layout components wrap shared context. The nesting tells you how users move through the product. You never look at it that way because you wrote it caring about renders and props, not user journeys.

Same goes for the App Router crowd if you're on Next.js. The file tree is the journey, you just don't read it like one.

I built a tool called Stepflo that reads that structure straight from your repo and turns it into a visual map of every flow in your product. Then it pulls your GitHub issues and pull requests and maps them to specific steps. So instead of "we've got a pile of bugs tagged login," you see "the OAuth callback step has 6 friction patterns. Most of them are reliability."

Works for Vite/React Router and Next.js App Router today (verified against my own Vite app and a handful of real-world Next.js monorepos). Free to use. No credit card. AI analysis included (caps on the AI calls because LLMs aren't free and I'm just one dude).

https://stepflo.ai/?utm_source=reddit

If you try it, tell me what the flow detection misses. The harder you push it, the better it gets.


r/reactjs 4d ago

Does Zustand Preserve the Relationship Between a Selected Value and Its Source Object?

17 Upvotes

I’m using Zustand and I have a Map<string, Persona>:

const persone = new Map([
  ["id1", { nome: "Mario", cognome: "Rossi", eta: 40 }],
  ["id2", { nome: "Dario", cognome: "Roi", eta: 34 }],
  ["id3", { nome: "Mari", cognome: "Ossi", eta: 32 }],
]);

If I change the nome of id2 from "Dario" to "Luigi" and I have a subscription to the name, my question is:

Can the subscription know directly that id2 changed and therefore have access to the modified object, or does it only receive the new value "Luigi" and have to search the Map/array to find the person?

In other words: Does Zustand preserve the relationship between the selected value (nome) and the object it comes from, or is that information lost by the selector?


r/reactjs 4d ago

Resource Free Animated grid loaders for React — 130+ variants, effects, shapes, color ramps, and a bitmap font.

1 Upvotes

Help me get 50 stars on GitHub :) ⭐

Highlights

  • 130+ variants across sequential, radial, cascade, flow, wipe, decrypt, letters, digits, symbols, and more.
  • 20 effects (pulsebounceglowspin, …) and 12 dot shapes (circlediamondstar, …)
  • Color ramps with horizontal, radial, angular, and other sampling modes.
  • Resolution-independent — the same variant scales cleanly from 2×2 to 12×12.
  • CSS-driven animation — one stylesheet, no runtime animation engine.
  • Accessible — role="status", optional labels, and respectReducedMotion.
  • Tree-shakeable ESM + CJS build with full TypeScript types.
  • npm: gridora
  • Editor: gridora.gabrielayer.com
  • GitHub: 0x65dgerunner

r/reactjs 5d ago

Needs Help Junior React developer getting into performance optimization — what should I learn next?

53 Upvotes

Hey everyone!

I’m a junior full-stack developer and recently started going deeper into React performance.

I’ve been exploring React Compiler, code splitting with React.lazy() and Suspense, bundle optimization, re-renders, memoization, and basic profiling with React DevTools.

I’d love to know what more experienced React developers think are the most important performance topics and best practices to learn next.

I’m especially interested in bundle size, rendering performance, caching, Core Web Vitals, and how to identify real bottlenecks without over-optimizing.

Any good resources, tools, or common mistakes I should know about?

Thanks!


r/reactjs 5d ago

Show /r/reactjs Haptics on Web are actually cool!

12 Upvotes

Haptics on the Web can be super satisfying if you use them right! I've had so much fun creating this little game.

My stack:
- React - as a foundation
TypeGPU - for particle effects
Pulsar Web SDK - for haptic effects

Try it in your browser: https://docs.swmansion.com/pulsar/web-app/#games/shape-cascade


r/reactjs 4d ago

Show /r/reactjs theodore-js now supports displaying inline suggestions in the editor!

0 Upvotes

Theodore-js 2.0.0 is out and now it supports displaying inline suggestions ✨🤗

With this feature, the suggested text appears faintly within the editor; the user can accept the suggestion—turning it into part of the main text—by clicking on it or pressing a key of your choice. ⌨️ A similar feature has been implemented and used in Google AI Studio.

Inline suggestions are especially useful for presenting AI-generated text completions as users write.

👉 You can find the documentation and instructions on how to use this feature on the website: https://theodore-js.dev

📦 install from npm: https://www.npmjs.com/package/theodore-js


r/reactjs 6d ago

Portfolio Showoff Sunday I got tired of boring loading spinners, so I built 70 of them

113 Upvotes

Hey y’all,

I got slightly carried away with loading animations.

I wanted nicer loading states for my own projects, but most libraries I found were either tied to a framework, fairly limited, or required more than I wanted for something this small.

So I built loadersz, a small framework-agnostic loader library for the web.

I wanted something a bit more expressive than the usual CSS spinner, without pulling in a UI framework or a bunch of dependencies.

A few things I focused on:

- 70 different motion states
- Canvas 2D instead of GIFs/videos
- zero core dependencies
- a native custom element, so it works with basically any stack
- typed entry points for React, Vue and Svelte
- configurable speed, density and color
- respects prefers-reduced-motion
- pauses rendering when the browser tab is hidden

Basic usage is just:

npm install loadersz

import 'loadersz';

<loadersz-loader state="racing" size="96" />

I also built an interactive playground where you can tweak the loaders live.

Demo: \[loadersz.vercel.app\](https://loadersz.vercel.app)
npm: \[npmjs.com/package/loadersz\](https://www.npmjs.com/package/loadersz)

Would love some brutally honest feedback, especially on which animations you’d actually use in a real product.


r/reactjs 5d ago

Needs Help In which cases do you actually need to manipulate the DOM directly in React?

4 Upvotes

React handles most UI updates for us, but there are still cases where direct DOM manipulation seems unavoidable. What are the cases you've encountered in real projects?


r/reactjs 5d ago

Portfolio Showoff Sunday I got tired of Waiting for DOMPurify to sanitize, made a 70x faster version

0 Upvotes

Hello everyone,

A few months ago, I was experimenting with DOMPurify and when users put in long fields like a paragraph, it used to hang a lot!

It would occasionally freeze for literal 15 seconds and more!!

Imagine sitting for your response to be submitted, and it hangs!?

So I've built DOMOxide, making it 70x faster and 5x smaller. Thanks to Rust and WASM, it sanitizes your HTML and makes it clear of XSS attacks.

It's a ~3kB gzipped + minified package that passes almost all tests as DOMPurify

> Repo: ppmpreetham/DOMOxide