r/reactjs Mar 12 '25

Needs Help An interviewer asked me to create a useFetch with caching

Upvotes

So in the last 15 minutes of the technical round the interviewer asked me to create a useFetch hook with a caching mechanism in the hook, as to not refetch the data if the URL has not changed and just return the cached data, also an option to refetch data when needed. I was able to create a useFetch hook with promises although I was stuck at the caching part. I tried to explain my approach by using local storage but he wasn't looking for a solution involving local storage. I am still struggling to find the right solution. If anybody could help me figure this out would be great!

r/reactjs Jul 30 '26

Needs Help Failed Fullstack intern questions as a .NET dev - why?

Upvotes

I am still playing the interview in my head and can't understand why I was classified as, "Has no knowledge in frontend or JavaScript".

I was asked the difference between DOM and vDOM, and I answered that React applies changes to the vDOM first then compares the nodes that have changed, then applies the differences on the actual page.

Then was asked about Hooks, explained how useState and useEffect are used, giving an example that useEffect has its uses when a state has changed, be it when a component renders or a variable changes. But I didn't give an example for useMemo, just that it is for caching, and useState is React's declaration of a var and its function.

Then the differences between var, let and const. Said that var is not recommended, and that let and const are im/mutable.

It wasn't for a junior or senior position - it was an internship. Have I been living in a bubble that I don't know what the market requires nowadays? I have a decade of experience in .NET - did that work against me where the interviewer expected much more / thought I was a phony?

r/reactjs Apr 29 '26

Needs Help Bombed the final question of a React technical discussion, looking for feedback

Upvotes

I'm a senior full stack developer at a consulting firm, and have about 15 years of experience. Almost all of the clients I've worked with have used React, and I'm extremely comfortable using it and know it fairly deeply.

This was a 30 minute discussion, and I felt really comfortable with my answers and he seemed pretty positive on how it was going. Then, I got hit with the curveball that I felt like broke the interview.

It started with him asking a simple question: "how would you manage state across components?" I gave him multiple answers (useState, useContext, third party libraries, Tanstack Query, etc) and he liked that. He then asked "what if you didn't have React and had no access to third party libraries?"

This tripped me up bad. My first thought was either some sort of state object or firing events off, but I was so caught off guard that my confidence faltered and I could not articulate on the spot how that would look. He then described their solution in more detail (using CustomEvent is primarily how they do it) and said that they work with a lot of Web Components, which is why it was asked. For clarity, I double checked, and there was no mention of this in the job description - the only mentions of frontend is your usual NextJs/Tailwind/Tanstack/etc mentions.

Is this approach to state management in vanilla JS common knowledge among developers who learned front end through these frameworks? I was surprised because up until that point, I was really feeling good with my answers. I'm going to brush up on my Web Component knowledge now, but I have never had to work with them in my entire career. It has always been through some sort of framework.

r/reactjs Oct 09 '25

Needs Help Frontend devs working with large datasets (100k+ rows) in production, how do you handle it?

Upvotes

Hey everyone,

I'm working on a project where we're anticipating the need to display and interact with very large datasets (think 100,000+ rows) in a table/grid on the frontend. The classic "just paginate it" answer isn't sufficient for our use case users need to be able to scroll, search, filter, and sort this data fluidly.

I know loading 100k rows into the DOM at once is a recipe for a frozen browser, so I'm looking into the real-world strategies you all use in production

r/reactjs Nov 10 '24

Needs Help React + Vite + 8000 Components = 54minutes Build

Upvotes

Hey everyone,

I am recently hired in a banking company as a project reviewer and they have massive projects which I think they designed react logic a little bit not good.

They have 8000 lazy components in vite environment and the build time takes 54minutes to build.

The old react developers was react junior developers and they didn't use best practices.

Many components are more than 1000 lines and so on. And they have many memory leaks problems

I have tried some clean up techniques and improvements which made the build time better. But still I think there's a lot to do

Can any one help me and guide me what to do and give me some hints

Thank you!

EDIT: Thanks everyone for your amazing help and recommendations. I am gathering a plan and proposal based on comments here and will start to do the work.

I will gather all information I learned here and publish recommendations here again

I may not be able answer. Thank you šŸ™

suggested technologies & methodologies: stranglers fig pattern, swc, Boy scouts rule, tanStack, module federation, astro, barell files, npm compare, parcel, roll up plugin visualiser, rs build,

r/reactjs Jan 31 '25

Needs Help What does a frontend framework like React ACTUALLY do?

Upvotes

Coming from gamedev (C#), I have an idea for an small interactive website which doesn't (I think) need a backend.

I've made a few websites with wordpress in my life, so I'll just say I have 0 webdev experience.

I know I can do this with C# via asp.net core and blazor, but I couldn't hurt me to learn some js/ts.

So, I learn html, css and js. I can make a website with it fully. So what is the role of frameworks like React? What does it do to make things easier for me?

Is it just a library of useful functions? Like, otherwise I'd need to type out a bunch of html and redirect via javascript and with React I can call something like void doThatThing();

Thanks for clarifying.

r/reactjs 13d ago

Needs Help shadcn vs HeroUI for a large, heavily customized enterprise product?

Upvotes

We’re currently choosing a UI library for a pretty large enterprise product and I’d love some feedback from people who have actually worked with these libraries at scale recently.

The product is going to handle a lot of interconnected data: employees, companies, departments, CRM-like records, multi-record management, tables, forms, chat, AI features, etc. So this isn’t a small app, and whatever we choose will probably become the foundation of our design system for quite a while. We’re also expecting to customize the UI quite heavily and create our own components on top of it.

From what I’ve read so far, HeroUI seems great if you want something polished and relatively plug-and-play. But I keep seeing people mention that once you start heavily customizing it or moving away from its intended patterns, things can become painful.

shadcn seems almost like the opposite approach. I don’t particularly like the default look, but since you own the components and can modify basically everything, it feels like a much better long-term foundation if you’re willing to invest some time upfront. Especially if the end goal is a custom design system rather than keeping the library’s visual identity.

For people who have used two or even Mantine on larger production apps: what would you choose today?

I’m especially interested in how they hold up after a year or two of customization, adding custom components, maintaining consistency across a large product, and building more complex AI/chat interfaces. I care less about which one looks best out of the box and more about which one we’re least likely to regret later.

TL;DR: Choosing between shadcn, HeroUI and possibly Mantine for a large enterprise/CRM product with lots of records, tables, employees, companies, chat and AI. We’ll heavily customize it and build our own components. HeroUI looks easier initially, while shadcn seems more flexible and maintainable long-term. Looking for feedback from people who have used them at scale.

r/reactjs May 22 '26

Needs Help Securely sharing .env files in small teams

Upvotes

We are a team of 3 devs building a web app, and our current setup of managing environment variables is completely broken.

Right now, whenever someone adds a new API key or changes a database string, they just paste the plain text into a private Discord channel and tell everyone to update their local files.

Inevitably, someone misses the message, pulls the latest main branch, and spends twenty minutes debugging an error that was literally just a missing variable string.

looked at enterprise tools like Doppler or HashiCorp Vault, but they feel like complete overkill for a tiny project and the configuration looks overly complex for what we need.

How are other small teams handling this without losing their minds? Is there a dead simple tool out there that just lets us run a terminal command to sync local files instantly?

r/reactjs May 05 '26

Needs Help First time interviewing candidates – what are the best React/frontend questions to ask?

Upvotes

Hi everyone,

I am a senior software engineer at a small company (~50 people), and we are currently hiring for a senior frontend developer. I have been asked to take the frontend interview, but I have never actually been an interviewer before.

Our interview process is not very structured yet, so I am trying to figure out how to best evaluate candidates especially their React and overall frontend knowledge.

For those of you who have been on either side of the table:

  1. What kinds of questions do you find most effective for assessing React skills?

  2. How do you evaluate real world frontend problem-solving vs. just theoretical knowledge?

3 What are some of the best or most memorable questions you have been asked (or asked others) in frontend interviews?

r/reactjs Apr 27 '26

Needs Help Why is it super complicated to start a new React project these days?

Upvotes

I'm returning to React dev after taking a break for 4 years or so and wanted to start a hobby project. Hot damn, are things more complicated!

ReactRouter used to be a routing solution that you'd simply install. Now it wants your entire project to sit on it's framework from the ground-up?

People are talking a lot about TanStack, but I just want a router, I can do the rest myself. Why do I need to include the entire Tan ecosystem in my project?

I'm not looking to build the next Google or YouTube, just looking to make a minimal GUI that I can run little light-weight SPAs on for a simple GUI, or load onto an ESP micro-controller to give it a web UI. I'm not looking for server-side anything.

I'm not sure if I'm confused and missing something obvious that I can't quite see. What's an easy way to start a new React SPA project these days?

r/reactjs 20d ago

Needs Help What router are you using

Upvotes

Currently I have to create a new project, my first option is react router (declarative mode). My entire project will live behind the login page

what are you using?

  • RR framework mode
  • RR data mode
  • RR declarative mode
  • tanstack router
  • wouter

r/reactjs Jul 12 '26

Needs Help is abort controller commonly used?

Upvotes

as title suggests, I have not seen this at work before and gemini teaches me about this, just curious whether this is actually commonly used/best practice or just another AI slop. Thanks!

r/reactjs 25d ago

Needs Help How are you handling partial JSON streaming to React components without the constant UI flickering?

Upvotes

I’m currently building a feature for a workflow tool where the backend streams structured JSON to render dynamic UI widgets (cards, mini data tables, and inline action buttons) directly in the workspace feed. Streaming raw Markdown is easy enough with standard hooks, but streaming structured JSON and trying to render React components as chunks come in is giving me major headaches. Right now, if I try to parse the incoming chunked string on the fly, I constantly hit \`Unexpected end of JSON input\` errors unless I use a custom partial parser. But even with a partial parser, rendering incomplete state causes the layout to shift and jump around like crazy every few milliseconds.If I give up on live rendering and wait for the full response to complete before displaying the component, the user is stuck staring at a loading skeleton for 4 to 6 seconds. That completely kills the real-time feel and defeats the purpose of streaming in the first place.Are there any solid open-source packages, state management tricks, or specific partial-JSON parsing patterns you're using to keep generative UI renders smooth? How are you gracefully handling incomplete schema objects mid-stream without breaking your design system constraints?

r/reactjs Sep 24 '24

Needs Help I learned React 3 times at different periods. I'm about to do it again after 2 years of break. I need tips for "current" React best/common practices

Upvotes

React (Like many other js frameworks) is fast changing. Every time I worked with it, it was different:

  1. I first messed around with it when it was initially open sourced. So JSX, Components as functions, mixins, and Virtual DOM. Cool stuff. I liked it but I wasn't using it at work so it faded.
  2. Two years later I Had a chance to introduce it in a small scale project at another job. This time using js classes instead of functions was all the rage, also no Mixins, and Redux OG was a popular thing.
  3. Another three years have passed and I was offered a front end gig. Classes are no longer popular and now we have hooks! useState is cool. useEffect is a source of bugs. React Query is a thing.

In the last two years I was a back-end engineer again and I'm trying to get back to front end. What's new in React? what should i focus on? What's a must know?

I'm afraid I'll chose an outdated tutorial. so - enter you fine people.

Thanks! <3

r/reactjs Jul 29 '26

Needs Help React + Node.js vs Next.js: Which should I focus on?

Upvotes

Hi everyone! I'm currently learning Next.js, but I've noticed that many job postings seem to ask for React + Node.js more often.

Do you think I should continue focusing on Next.js, or would it be better to switch my focus to React and Node.js first? I'd really appreciate your advice and experiences. Thanks!

r/reactjs Mar 24 '26

Needs Help I have been tasked with refactoring a React codebase but i never used React before, do you have any tips?

Upvotes

I'm at the end of my bachelor in CS, and for the thesis i've been tasked with refactoring a React codebase built by other students for the past 1 year.

I've been studying React a lot these past 2 weeks to prepare for the task and I now understand most of the basic principles, but I feel like you need to have a pretty deep understanding of the language in order to be able to refactor it.

Do you have any suggestions about what to look for, or a general method for finding bad code?

I want to add that, even though i never applied them, i did study the concepts of refactoring (like design patterns and code smells), so i'm asking mainly about how to apply these concepts, and if there are any good practices specific to React that i should know and follow.

r/reactjs Sep 12 '24

Needs Help I’m trying to convince my workplace to use React. However the security team are worried about the Inflight memory leak problem. How do I approach this?

Upvotes

The way we develop currently is terrible. For a long time I’ve been arguing for the case of using modern technologies like React, Vite and Storybook.

Our work computers must go through a firewall and the security department has blocked most npm packages. When trying to convince them to leaf us install various React related packages they said they won’t because the Inflight package that these have a dependency on has a memory leak issue.

This is true, but I have no idea how serious it is or what it even really does. Inflight is used in a lot of packages we want to use like Storybook and Eslint.

Would anyone have any ideas on how to approach this issue with security? Surely this hasn’t stopped everyone using this packages? And surely we can’t just wait until they’re all updated?

Would anyone be able to give me anymore info or opinions?

Many thanks in advance.

r/reactjs Apr 15 '26

Needs Help Should I learn React from a long Udemy course or a quick YouTube playlist?

Upvotes

I want to learn React in 2026, but my main problem is that I don’t know how to start.

I have a Udemy course by Jonas Schmedtmann that’s 80+ hours long (it includes projects, how React works, etc.). However, when I ask my college seniors, they suggest finishing React quickly using a one-shot video or a short playlist on YouTube instead of going through such a long course.

Now I’m confused about what to do. Should I stick with the 80+ hour Udemy course, or should I try to learn React quickly from shorter resources?

r/reactjs Feb 04 '26

Needs Help Is React Query the ā€œdefaultā€ state manager now, or are we overusing it?

Upvotes

I’m trying to standardise how we split state in a mid-sized React app.
What’s your rule of thumb in 2026 for choosing between:

  • React Query (server state / cache)
  • URL state (filters, pagination, shareable state)
  • local component state
  • global client state (Zustand/Redux/RTK)

Specifically: where do you draw the line to avoid double sources of truth (RQ cache + store), and what app constraints still justify Redux/RTK today (offline, multi-tab sync, audit log, complex workflows, etc.)?

r/reactjs Jul 02 '26

Needs Help Best Method to Call Apis on Page load

Upvotes

I have an app that calls 3 different APIs on page load, where each call depends on the previous one succeeding — API 2 only fires after API 1 returns successfully, and API 3 only fires after API 2 returns successfully.

I'm considering three approaches: a useEffect with an empty dependency array, TanStack Query, or SWR.

Would TanStack Query with the enabled option be the best approach here, or does anyone have a better recommendation?

r/reactjs Aug 02 '26

Needs Help I think my React Router transition library is ready for v1 — looking for developers to break it

Upvotes

I’ve been working on Routeveil, an open-source transition engine for React Router.

v0.4.0 is now out, and this is essentially the final feature release before v1. There may still be fixes and API adjustments based on testing, but the core feature set is complete.

It currently supports:

- page and full-screen overlay transitions

- shared elements between routes

- custom React content rendered between transition phases

- route readiness and lazy-route preloading

- programmatic navigation and same-page transition playback

- interrupted-navigation cleanup, scroll handling, focus, and reduced motion

The main idea is that the transition is selected where navigation begins instead of putting animation logic inside every route:

<RouteveilLink
  to="/gallery"
  transition={{
    name: "slide",
    direction: "left",
  }}
>
  Open gallery
</RouteveilLink>

demo: [https://www.routeveil.dev/lab]()

docs: [https://www.routeveil.dev/docs]()

repo: [https://github.com/milkevich/routeveil]()

also checkout

shared elements: https://www.routeveil.dev/lab/shared-elements

between render: https://www.routeveil.dev/lab/between

I’m specifically looking for React Router developers willing to test it in an actual project before I call it v1

I’d especially appreciate feedback on:

  1. whether the API feels intuitive
  2. anything that breaks in real routing setups
  3. anything you would consider a blocker for v1

r/reactjs Jun 24 '26

Needs Help Should I use a real game engine or React JS?

Upvotes

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 May 26 '26

Needs Help Clean Architecture in React.js (Monorepo) with Auth Libraries + TanStack Query/RTK Query — how do you structure it realistically?

Upvotes

I’ve been trying to properly understand and implement Clean Architecture on the frontend with Next.js (frontend-focused, not backend), but I’m getting confused once third-party libraries enter the picture — especially auth libraries and query libraries.

Most examples online are either:

  • too theoretical,
  • too backend-oriented,
  • or avoid real-world libraries entirely.

My setup is something like:

  • React.js
  • Monorepo (Turborepo)
  • Shared packages
  • Auth library (like Better Auth / NextAuth / Clerk / etc.)
  • TanStack Query or RTK Query
  • TypeScript

What I’m struggling with is:

1. Where should auth libraries live in Clean Architecture?

For example:

  • should the auth client be wrapped behind interfaces/adapters?
  • should the UI directly call the auth library hooks/functions?
  • where do auth-related side effects belong?
  • how much abstraction is ā€œtoo muchā€?

Example:

authClient.signIn.email(...)

Should this be hidden behind:

AuthRepository.signIn()

or is that unnecessary abstraction on the frontend?

2. How do query libraries fit into Clean Architecture?

If using:

  • TanStack Query
  • RTK Query

then:

  • where should queries/mutations live?
  • do you create ā€œuse casesā€ on the frontend?
  • should hooks directly call APIs?
  • should query libraries exist only in the infrastructure layer?

I see people saying:

  • ā€œdon’t leak library-specific codeā€
  • ā€œkeep business logic isolatedā€

But in frontend apps, the query library becomes deeply integrated into state management and caching.

So what does a realistic architecture look like?

3. Monorepo structure confusion

How do you structure things in a monorepo without overengineering?

For example:

apps/
  web/
  mobile/

packages/
  auth/
  api-client/
  ui/
  contracts/
  utils/

Do you:

  • keep auth client inside a shared package?
  • export inferred types from there?
  • keep query logic centralized?
  • create repositories/services/use-cases packages?

How far do people actually go in production apps?

4. How do you avoid overengineering?

This is probably my biggest issue.

I understand the theory of:

  • entities
  • repositories
  • use cases
  • dependency inversion

But when implementing real frontend apps, I end up wondering:

  • am I just wrapping libraries for no reason?
  • am I creating abstractions that add zero value?
  • how do experienced frontend engineers decide what deserves abstraction?

I’d really appreciate:

  • real-world folder structures,
  • examples from production apps,
  • monorepo-specific advice,
  • or articles/repos/videos that show Clean Architecture with modern frontend tooling.

Especially interested in opinions from people using:

  • React.js
  • TanStack Query
  • RTK Query
  • Better Auth / NextAuth / Clerk
  • Turborepo monorepos

r/reactjs Oct 10 '24

Needs Help Am I doing it wront by trying to develop almos everything using OOP principles?

Upvotes

I have c# & Laravel background and used to use OOP everywhere.
Seems like react's procedural nature is disrupting me very much.

When I try to use OOP in state, component, even in some utils there is at least one unintentional thing that makes me to rewrite everyting to plain objects again.

I'm using redux for state management (even if I don't use it the problem stays again).

Let's see an example:
```js
const UserFullName = () => {
const user = useUserState();

// since we're discouraged to save non-serializable value in state
// I have to create object in component, which makes huge mess for memory, perfornamce and garbage collector
const userObject = new User(user);
return <div>{user.getFullName()}</div>

// Or I have to do something like this
return <div>{getUserFullName(user)}</div>
}
```

There was many cases when I implemented OOP and then hit the wall without any workaround to refactor it to procedural or functional.

Am I the only one or at least one of you has same problem?

r/reactjs 11d ago

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

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!