r/reactjs • u/Humble_Parfait_4003 • Jun 26 '26
What can be some creative npm packages which can be used to build a portfolio in react for a software developer?
Also welcome for some portfolio ideas too π
r/reactjs • u/Humble_Parfait_4003 • Jun 26 '26
Also welcome for some portfolio ideas too π
r/reactjs • u/chhsiao1981 • Jun 26 '26
https://github.com/chhsiao1981/use-thunk#getting-started
A complete demo site:
https://chhsiao1981.github.io/demo-use-thunk/
https://github.com/chhsiao1981/demo-use-thunk
Global state management (GSM) can be tricky for complicated reactjs applications.
Many GSM frameworks (redux/zustand/etc.) focus on "we have a store, and how do we manage the global states in this store." However, such approach usually leads to create a gigantic function (reducers in redux/RTK, create in zustand).
Similar to many typical programming languages, in use-thunk:
File-as-a-Module: Instead of a giant global store, we treat files as independent, isolated domain modules where we implement thunk functions.
Object Identification: The module manages state as discrete entity nodes. We use explicit id parameters to identify and operate on individual data objects within that module cleanly.
Clean Component Interface: From the component perspective, we simply invoke the module's functions to perform operations.
Only One Context Provider: Unlike standard useContext or Redux architectures that require nesting endless providers, we only need exactly one <ThunkContext></ThunkContext> wrap in our main.tsx. It entirely eliminates "Provider Hell" and the architectural uncertainty of managing stacked providers.
A complete example to do increment:
// thunks/increment.ts
import { type Thunk, type State as _State, update } from '@chhsiao1981/use-thunk'
export const name = 'demo/Increment'
export interface State extends _State {
count: number
}
export const defaultState: State = {
count: 0
}
// upsert directly with set.
export const increment = (myID: string, num: number = 1): Thunk<State> => {
return async (set, get) => {
let me = get(myID)
const {count} = me
set(myID, { count: count + num })
}
}
// or we can treat set as dispatching a base action function (update).
export const increment2 = (myID: string): Thunk<State> => {
return async (set, get) => {
let me = get(myID)
const {count} = me
set(update({ count: count + 2 }))
}
}
// or we can use set as dispatching a thunk function.
export const increment3 = (myID: string): Thunk<State> => {
return async (set) => {
set(increment(myID, 3))
}
}
// components/App.tsx
import { useThunk, getState } from '@chhsiao1981/use-thunk'
import * as ModIncrement from './thunks/increment'
export default () => {
const useIncrement = useThunk<ModIncrement.State, typeof ModIncrement>(ModIncrement)
const [increment, doIncrement, incrementID] = getState(useIncrement)
// to render
return (
<div>
<p>count: {increment.count}</p>
<button onClick={() => doIncrement.increment(incrementID)}>increase 1</button>
<button onClick={() => doIncrement.increment2(incrementID)}>increase 2</button>
<button onClick={() => doIncrement.increment3(incrementID)}>increase 3</button>
</div>
)
}
// main.tsx
import { registerThunk, ThunkContext } from "@chhsiao1981/use-thunk";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import * as ModIncrement from './thunks/increment'
import App from "./components/App";
registerThunk(ModIncrement)
createRoot(document.getElementById("root")!).render(
<StrictMode>
<ThunkContext>
<App />
</ThunkContext>
</StrictMode>,
)
Welcome any comments, critiques, or suggestions!
r/reactjs • u/zagrodzki • Jun 24 '26
Quick update on loading-ui, the open-source loading component registry I shared here before.
New: color presets. 8 colors (black, blue, violet, orange, red, green, yellow, sky) you can switch on https://loading-ui.com and instantly preview every loader in that color.
How it works in React:
Components use currentColor, so theming is just setting color on a parent:
<div style={{ color: "var(--loader-blue)" }}>
<Ring className="size-8" />
<TextShimmer>Loading...</TextShimmer>
</div>CSS variables are OKLCH-based with auto-generated gradients:
--loader-violet: oklch(0.7217 0.1768 305.49);
--loader-violet-gradient: linear-gradient(in oklch 135deg, ...);Dark mode: black preset flips to white in .dark.
Still install components the same way:
npx shadcn add @loading-ui/ringIf you use loading-ui already, curious whether preset CSS vars are useful or you'd rather stick with Tailwind text-blue-500 utilities?
r/reactjs • u/creasta29 • Jun 24 '26
Newsletters at Scale with Sebastian Lorber (This Week in React) | RSS Curation, Acquisition, RSC
r/reactjs • u/arealguywithajob • Jun 24 '26
r/reactjs • u/creasta29 • Jun 23 '26
React gives you a lot of ways to make two components share data but it gets more and more complicated based on the data and how far apart the components are. Lets see the different ways components can communicate with each other.
r/reactjs • u/dca12345 • Jun 24 '26
What tech would you use to build an infinite canvas type application with drag/drop, flowcharting/mind mapping, but also basic animations for those same elements? Would you use this recommended library within React?
r/reactjs • u/hottown • Jun 24 '26
r/reactjs • u/Pratik2980 • Jun 23 '26
I'm running a React (Vite) application in Azure Container Apps behind Nginx.
My Nginx config is:
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}The app works fine initially, but after a new deployment, some users who have an older tab open get errors like:
Failed to fetch dynamically imported moduleor
GET /assets/Diagnostics-xxxxx.js 404The chunk file no longer exists because Vite generated a new hash in the latest deployment.
I've seen recommendations such as:
window.addEventListener("vite:preloadError", () => window.location.reload())index.html/assets for a long timeFor teams running Vite in production on Azure Container Apps, what's your preferred approach to avoid blank screens and chunk mismatch issues after deployments?
Do you automatically reload the page, keep old assets available for some time, or use another deployment strategy?
Would appreciate hearing real-world production setups.
r/reactjs • u/Cybicc • Jun 24 '26
I'm trying to make a game that is entirely UI kinda like papers, please. Would it make more sense to use a game engine like Unity/Godot or would using Reactjs be a better alternative? Thanks.
r/reactjs • u/souljorje • Jun 23 '26
d3-maps helps build choropleth maps, bubble maps, and other geographic data visualizations, using markers, connections, zoom & pan and more.
Reactive components, plain SVG and d3.js power without low-level wiring.
Alternative to react-simple-maps
@d3-maps/react can fully replace react-simple-maps, supports React 19 an has more features under the hood. Migration guide is available in the docs.
Usage
Here's a brief snippet of a zoomable map using d3-maps. You can find more examples on docs website.
import { use } from 'react'
import { MapBase, MapFeatures, MapZoom } from '@d3-maps/react'
const worldPromise = import('@d3-maps/atlas/world/countries')
.then((m) => m.default)
export function MapView() {
const world = use(worldPromise)
return (
<MapBase>
<MapZoom>
<MapFeatures data={world} />
</MapZoom>
</MapBase>
)
}Repo
https://github.com/souljorje/d3-maps
I'd appreciate your star on Github and feedback in comments, thanks!
r/reactjs • u/Salt_Walrus_658 • Jun 23 '26
Just launched my UI library π
π Website: ui.bynana.dedyn.io I built a React & Next.js UI library packed with 200+ modern components, SaaS landing pages, and portfolio templates to help developers build beautiful websites faster.
β¨ Built with: β’ React β’ Next.js β’ Tailwind CSS β’ Modern animations & responsive UI
Would love your feedback and suggestions β€οΈ
r/reactjs • u/Ivandre • Jun 22 '26
Every cookie-consent option I found was either a heavyweight SaaS script that phones home and tanks your Lighthouse score, or an unmaintained banner component I'd have to rebuild around. So I made consentium and figured I'd share it here for feedback.
It's one provider, one banner, one stylesheet, and a tiny store you drive from your own code. You decide what each category gates β the lib just records the decision and tells your app about it.
The two things I actually care about that most alternatives skip:
The rest:
Google Consent Mode v2: not baked in, but there's a documented recipe in the repo for bridging the store to gtag's consent("update") if you'd rather load gtag up front and gate via denied/granted.
Disclaimer up front: it's engineering tooling, not legal advice. It gives you the mechanism for consent β you own the categories, the copy, and whether it actually satisfies the rules where you operate.
Repo: https://github.com/ivandrenc/consentium (MIT)
Genuinely after feedback, not stars:
r/reactjs • u/Dazzling_Chipmunk_24 • Jun 22 '26
So down below is my next.config.ts file
const nextConfig = {
distDir: 'out',
output: 'export',
images: { unoptimized: true },
}
export default nextConfigI'm using the Next.js Pages Router with a structure likeΒ pages/friends/index.tsxΒ everything works fine locally β hittingΒ /friendsΒ in the browser loads the page no problem. But after deploying, navigating directly to the URL gives a 404. Interestingly, client-side navigation viaΒ useRouterΒ fromΒ next/routerΒ works fine β it's only direct URL entry or hard refresh that breaks.
r/reactjs • u/Accurate-Screen8774 • Jun 22 '26
TLDR; The title of this post.
Feel free to reach out for clarity instead of reading the code/docs.
I was working on a βReact-like syntax" for webcomponents, I wanted to create something robust and flexible for secure data storage and management.
I started off with an approach for asynchronous state management so that components outside the shadow-root could receive updates. (The events are also encrypted to secure against things like browser extensions.)
https://positive-intentions.com/docs/projects/dim/async-state-management
It then made sense to be able to persist that data so it can work between page releoads.
https://positive-intentions.com/docs/projects/dim/bottom-up-storage
The result looks and works like the following when used in a project.
https://positive-intentions.com/docs/projects/dim/encrypted-store
The Dim framework seems like a dead-end. I wanted to try it out on my existing React projects. So I created the equivalent React hooks.
https://positive-intentions.com/docs/projects/dim/use-dim-store-react
I find it to be performant and I want to push the scale of the approach, so I am in the process of testing it out on my projects. A notable use-case there is storing encrypted files at rest.
IMPORTANT: Im not trying to promote βyet another ui frameworkβ, this is an investigation to see what is possible. You should not use this in your own code. It is not reviewed, audited or production-ready. It is not on npm. Shared for testing, feedback and demo purposes only.
r/reactjs • u/cryptomallu123 • Jun 22 '26
r/reactjs • u/paimeg • Jun 21 '26
Search-by-meaning (not just keyword/substring matching) usually needs backend or an embedding API. I wanted to see how far client-side could go, so I built a tiny LLM that ships inside your bundle and runs entirely in browser.
Where I think it could be useful:
β’ search-as-you-type with no backend
β’ docs/site search on static sites (Astro, Next, etc.)
β’ edge functions and workers
Specs: 7 MB single bundle (model + tokenizer + engine, oneΒ .wasm) ~2ms per query in-browser
See demo: semantic search over 2,000 React docs, fully on-device βΒ https://ternlight-demo.vercel.app
Also see evaluation leaderboard in similar class of models: https://agentx-ray.aurumnebula.com/embed-board.html
This is a hobby project that I plan to open source, no npm package yet, but the engine works end to end. Curious what you'd actually use client-side semantic search for?
r/reactjs • u/fnascimento9 • Jun 22 '26
Hey,
I wanted to share a mini ecosystem I've been working on:Β fn-ui-avatarsΒ andΒ fn-ui-avatars-react.
The Problem:Β When using standard initials avatar APIs (like ui-avatars.com) withΒ background=random, users get completely random colors on every render or device, causing a chaotic UI. If you don't use random, everyone gets the same boring gray. Also, text contrast is rarely optimized for the generated background.
The Solution:Β I built a framework-agnostic core library and a React wrapper that generatesΒ deterministic colorsΒ based on the user's name using a quick djb2 hash algorithm. The same name always gets the exact same background.
It also featuresΒ Smart Contrast, calculating the background luminance on the fly to automatically flip the text color between black and white for maximum accessibility.
Features:
I just deployed a live interactive playground and full documentation here:https://fn-ui-avatars-docs.vercel.app/
The project is fully open-source. I would love to hear your feedback on the code, API design, or any features you think are missing! If anyone wants to contribute (or build Vue/Svelte wrappers), you are more than welcome.
Thanks!
r/reactjs • u/Stevious7 • Jun 21 '26
I wanted to add a plugins system to my application securely, and it's proving to be a bit tricky.
Obviously plugins are going to be some extra JS that the users load. I want to make it so that the plugins have certain permissions they have to declare in a manifest.json file, and based on these permissions, I could render to the user what kind of "data hooks" the plugin is requesting. The "data hooks" will basically just be a bus subscribe/emit object that takes in callbacks on certain events and fires the associated callback functions. I also want the plugins to declare in the manifest.json what kind of URLs they want to send requests to and show that to user.
Here's the problem though: a plugin could declare that it wants access to a certain piece of information but its JS could be doing all kinds of malicious things. How can I make sure the JS is sandboxed and only the information that I want it to have, it will have? How can I intercept the fetch requests to make sure only the URLs defined in the manifest the plugin is requesting from?
Thanks in advance!
r/reactjs • u/Opening-Gazelle-8196 • Jun 22 '26
Ive caught three hardcoded api keys this sprint and every one came out of an ai scaffolding session where the model inlines a key to run the sample and the dev forgets to strip it back out. one was a live stripe key that only spotted because i happened to be reviewing that PR by hand and id rather not rely on luck for this.
once it gets past the commit its in the git history anyway and a scanner that flags it a couple weeks later isnt much help by then.
We're mostly frontend and theres not many of us so im looking at gitleaks or trufflehog for a pre-commit hook. only problem is it fires when the dev has it installed and eventually someone reclones or sets up fresh and skips that step, so i probably want a server side check as backup too.
How are you all dealing with this and where did you end up putting the check so it doesnt drag every commit out
r/reactjs • u/Sure-Energy-1131 • Jun 21 '26
Hey Everyone,
Iβve been obsessed lately with Y Combinator's recent Request for Startups (RFS) on Dynamic Software Interfaces.
The thesis is simple: today's SaaS is incredibly rigid. We design fixed dashboards, tables, and settings to fit the "average" user, but in reality, every manager, engineer, and operator wants to shape the page to fit exactly how they work on a given day. Instead of developers building 50 custom dashboards, the RFS suggests we should expose our systemβs basic primitives, and let an LLM dynamically shape, style, and compose the interface in real-time based on natural language commands.
I think this concept is going to be massive for the web world. But as an engineer, when I first thought about letting an AI model write arbitrary code and run it directly in a userβs browser, my immediate reaction was: "This is a security and XSS nightmare waiting to happen."
Over the last few weeks, Iβve been building a prototype called Veneer (currently in early development) to see if we can actually solve this architectural and security puzzle. I want to share the architecture, get your feedback on its buildability, and discuss any potential security holes.
YES! If you are familiar with the Model Context Protocol (MCP), you already understand the core philosophy behind Veneer.
MCP gives an AI model a typed, described set of capabilities (tools, prompts, and resources) to interact with a system safely. Veneer applies this exact same concept specifically to your frontend interface.
Instead of letting an AI browse a database directly or execute raw API calls on your server, you declare a "Registry" of what data sources can be read and what actions can be run. The AI writes standard React code that utilizes these exposed capabilities, but at runtime, our secure bridge acts as the strict MCP hostβvalidating and enforcing every query and action ID on your host server/context before executing your real code. It's essentially an in-browser MCP wrapper for your React components.
If an AI-generated UI has direct access to the page's DOM or Javascript context, a slightly misaligned model or a prompt injection could easily:
localStorage / sessionStorage and steal auth tokens.To solve this, Iβve been working on a three-layer sandbox architecture that isolates generated code completely from the parent app.
Here is a visual ASCII flow of how the pieces communicate:
+ββββββββββββββββββββββββββββββββββββββββββββββββ================βββββββββ+
β Parent Host Application (Your Real App) β
β β
β 1. Declare Capabilities 3. Enforce & Run Real Code β
β [Registry] (Plain-Text) [Bridge Server] β
β β β² β
β βΌ β (Secure postMessage) β
β +βββββββββββββββ+ β β
β β AI Generator β ββ(writes safe code)βββΊ +βββββββββββββββββββββββββ+ β
β +βββββββββββββββ+ β Sandboxed IFrame β β
β β (Opaque Origin) β β
β β β β
β β 2. Runs generated UI β β
β β isolated from parent β β
β +βββββββββββββββββββββββββ+ β
+ββββββββββββββββββββββββββββββββββββββββββββββββ================βββββββββ+iframe with an opaque, restricted origin (sandbox="allow-scripts"). The iframe has no network access to your cookie context, cannot access localStorage, and has zero credentials.createTask or updateTask), it posts a { action, args } message to the parent. The parent validates this ID against the registry and runs the actual function.To keep the developer experience as simple as possible, I designed a React wrapper that handles the provider, iframe, and chat communication:
// 1. Declare what your app allows (The Contract)
const registry = {
dataSources: [
{ id: 'tasks', description: 'The userβs current task list.' }
],
actions: [
{ id: 'createTask', description: 'Create a new task.' },
{ id: 'updateTask', description: 'Update an existing task.' }
// No 'deleteTask' registered here -> AI UI can never delete data!
]
};
// 2. Drop in the three components
function App() {
return (
<VeneerProvider registry={registry} actions={actions} data={{ tasks }}>
{/* Renders the sandboxed iframe */}
<VeneerFrame style={{ height: 600 }} />
{/* Renders the AI companion floating chat */}
<VeneerChat />
</VeneerProvider>
);
}iframe with sandbox="allow-scripts" (and proper CSP headers blocking network requests) truly provide a robust capability boundary? Are there side-channel attacks or browser quirks we should worry about?Right now, we are in the active development phase, refining the compiler and bridge performance. I really think this can change how we conceptualize personalized software, but I'd love to hear your raw engineering opinions, security concerns, and architectural critiques!
If you want to play around with the active prototype or see it running, I pushed a live preview playground and early docs to veener.vercel.app.
You can join the waitlist to hear back from us.
Let's discuss! Would love to hear your thoughts.
r/reactjs • u/JoCraft2010 • Jun 20 '26
Hey r/reactjs,
I wanted to share an open-source library I've been working on called Clonkie.
Most cookie and/or consent libraries I've seen either feel like they weren't written with React in mind, are bloated or come with UI that doesn't care about your design system.
That's why I decided to take a different approach with Clonkie. It has zero dependencies and only does what it needs to while still handling cookie consent in a way that fits in with the rest of the system.
useCookie<T> hook pretty much like you'd use a useState<T> hook in React. It will serialize complex types automatically.useCookie<T> depends on a scope (e.g. marketing). If the user hasn't consented to it, setting the cookie does nothing by default to ensure GDPR-compliance.useCookieBanner in your banner component, from there you build your UI that fits your app.For a full example, refer to the GitHub repository below.
This library is still quite new and hasn't been battle-tested in an actual application, so expect bugs. I would love to hear your feedback and feature suggestions on this and maybe even receive some users and contributors π!
PS: I know, I used an em-dash in the title. I'm still a human and not an AI.