475,547 questions
-3
votes
0
answers
44
views
Why does React StrictMode create duplicate WebSocket subscriptions even when cleanup runs correctly? [duplicate]
I'm debugging a React 18 application that establishes a WebSocket connection inside a custom hook.
function useSocket(url) {
useEffect(() => {
const socket = new WebSocket(url);
socket....
Tooling
1
vote
4
replies
115
views
How can I add a label below a QR code and export it to PDF in React?
I am working on a React project where I need to export the QR code along with the custom labels in PDF format.
What is the recommended approach to achieve this ?Are there any libraries or best ...
-2
votes
0
answers
52
views
Tailwind CSS 4 "Cannot apply unknown utility class lg:" [duplicate]
I started a React.js project with Tailwind CSS 2 days ago. Today I opened my project, and it showed me this "Cannot apply unknown utility class lg:" error. Although lg: is a valid Tailwind ...
-2
votes
1
answer
102
views
React component behaves differently in production (AWS Docker) than localhost [closed]
React component behaves differently in production (AWS Docker) than localhost
I have built a video conferencing application using React, Node.js, Express, LiveKit, Docker, and AWS EC2.
Expected ...
1
vote
1
answer
59
views
React Native Reanimated SVG Circle Progress initial animation not working, but prop updates animate correctly
I am a beginner with React Native Reanimated.
I have a circular progress component using Reanimated and SVG. The animation works correctly when the progress prop changes after the component is ...
3
votes
0
answers
119
views
Cannot find module 'react/jsx-runtime' or its corresponding type declarations after switching to pnpm from npm
I'm getting the following TypeScript error after migrating my Next.js project from npm to pnpm:
This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure ...
Best practices
0
votes
1
replies
55
views
What is the recommended architecture for preserving infinite-scroll state and scroll position across navigation in Next.js applications?
I'm building an e-commerce application with an infinite-scrolling product list.
A user may scroll through multiple batches of products, open a product detail page, and then navigate back to the ...
-2
votes
0
answers
70
views
Next.js build fails at closing </Layout> tag [closed]
I am deploying a Next.js project to Vercel and the build fails during next build. The error points to the closing </Layout> tag in pages/index.js and shows "Expression expected" and &...
-4
votes
0
answers
83
views
Where to fetch and store global data (user, venue, socket) in React [closed]
In large applications we need global data, which means some data needs to be fetched first/globally,
For example user data needs to be used in whole app
Current selected venue data needs to be used ...
Best practices
2
votes
0
replies
65
views
How can I measure whether React dynamic imports are actually improving application performance?
I am working on a large React application and have started using dynamic imports with React.lazy() to reduce the initial bundle size.
Example:
const Dashboard = React.lazy(() => import('./Dashboard'...
Advice
1
vote
4
replies
109
views
How do I generate SEO-friendly meta tags in React?
I'm developing a React-based website and want to improve its SEO performance. Since React applications often render content on the client side, I'm looking for the best way to manage dynamic meta tags ...
-2
votes
0
answers
36
views
React Query returns stale data after mutation even though query invalidation is triggered [duplicate]
I am using React Query to manage server state for a user management page. Users can update profile information through a form, and after a successful update I invalidate the related query so that ...
-1
votes
1
answer
114
views
React useEffect cleanup function not running when component unmounts inside conditional render
I'm building a chat component that subscribes to a WebSocket when mounted and should unsubscribe on unmount. The cleanup function in useEffect doesn't seem to fire when the component
is removed via a ...
-3
votes
1
answer
151
views
How do I use useRef as input in a function with TypeScript? [closed]
I am trying to make an automatic scroll preference in production environments. For the scrolling utility for my React website I have chosen TypeScript due to what I have heard about its ability to ...
Best practices
0
votes
0
replies
61
views
What is the best strategy for managing permissions and role-based access control (RBAC) in a large React application?
I am working on a large React application that supports multiple user roles such as Admin, Manager, Editor, and Viewer. Each role has access to different pages, components, actions, and API operations....