477,244 questions
0
votes
1
answer
12
views
ReactJS Web App Cannot Access Microphone When Mobile Device Is Locked
I’ve built a ReactJS web application that uses the mobile device’s microphone through the browser (using getUserMedia). Everything works correctly while the device screen is on and the browser is in ...
0
votes
0
answers
21
views
Edit the date using the text field while opening the calendar popup
Currently, I'm using @mui/x-date-pickers v5 to display a calendar. My requirement is to keep the calendar open while changing the date using the text field.
Current behavior: When clicking the text ...
-1
votes
0
answers
31
views
Color picker not responding to user inputs
I am working on a react application and I want to show a color picker in a modal, but the color picker doesn't work. It's rendered to the screen, but the user can't change colors. Could I get some ...
-1
votes
2
answers
43
views
Why I Cannot apply unknown utility class `border-border`? CssSyntaxError: tailwindcss [duplicate]
This is my global.css
@import "tailwindcss";
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4....
0
votes
0
answers
24
views
React Navigation: app crashes when swapping between AuthStack and MainStack inside a single NavigationContainer after login/logout/signup
I manage auth with a context that exposes user and loading. On auth state change (login/logout/signup), I conditionally render either an Auth navigator or the App navigator.
What works
If I only mount ...
1
vote
0
answers
25
views
When the ReactNative rendering function encounters an error, it will trigger the rendering function again and swallow some error information
Description
reproduction demo
let count = 0;
const App = () => {
console.log('render App...................' + ++count)
throw new Error("Test Error: count=" + count);
return (
&...
-2
votes
0
answers
28
views
Expo Google OAuth: makeRedirectUri returns exp:// instead of auth.expo.io, and manual redirect URI causes "Something went wrong" error
I'm implementing Google OAuth in my Expo app using expo-auth-session and Firebase, but I'm facing two interconnected issues:
makeRedirectUri({ useProxy: true }) returns exp://192.168.1.48:8081 ...
Tooling
0
votes
4
replies
38
views
ESLint exhaustive-deps rule doesn't recognize stable refs when passed to custom hooks
I'm trying to factor out a useCallback that uses refs into a custom hook, but ESLint's exhaustive-deps rule keeps complaining about missing dependencies, even though refs are stable and shouldn't be ...
-5
votes
0
answers
40
views
Laravel + React (Old & Incomplete App to make it work) [closed]
I'm very tired here, first day of stage, I have to make an old app work and it's not my code... Boss gave me 2 zips, 1 should be FE, the other should be BE.
The first time I heard it i thought to ...
1
vote
1
answer
57
views
How to make Component show on top of MapContainer in React application using React-leaflet
I have a react app that uses React-Leaflet. The Application renders a map, and on top of the map there should be a component that shows a modal. Instead, the modal is shown underneath the map. How can ...
-2
votes
0
answers
33
views
App redirects back to login after successful login when deployed with Apache proxy [closed]
I deployed my React + Vite project on a server. Initially, everything worked fine when running directly on the server IP — the frontend was running on port 3000, and the backend (including Socket.IO) ...
-3
votes
1
answer
87
views
Why does my component re-render infinitely when using useState inside a setTimeout? [duplicate]
I'm building a live clock component in React using useState and setTimeout. The goal is to update the time every second. However, as soon as the component mounts, it triggers infinite re-renders and ...
-1
votes
0
answers
38
views
line chart styling not working as expected
I have been trying to make a line graph with a gradient fade area.
but whatever I do, it does not apply.
import * as React from 'react';
import { LineChart } from '@mui/x-charts/LineChart';
import { ...
-4
votes
0
answers
46
views
React.js directives vs decorators [closed]
I can't quite wrap my head around this. Why did the React and Next team chose to rely on JavaScript directives instead of decorators?
Decorators are widely used by a plethora of frameworks like ...
-1
votes
0
answers
27
views
React 16 and antd 3.x causing issues in api calls
Im working on an application using react 16, antd 3.x and redux thunk 2.3 which is calling the apis repeatedly on list pages.
Im not able to figure what is causing the retrigger of the useEffect with ...
1
vote
1
answer
65
views
pass data to tsx code stored in a variable
I have tsx stored as a template in a variable like so
// file a
let v = <div>text</div>
This should be used with some context or parameters in other files.
// file b
import v from a.tsx
...
-3
votes
1
answer
47
views
I'm not able to use the cmd, npm install -D tailwindcss postcss autoprefixer ,not able to get the tailwindConfig.js file to use the tailwind properly [duplicate]
I'm not able to use the command
npm install -D tailwindcss postcss autoprefixer
in my frontend(react/vite).
So whenever I use this command along with npm i tailwindcss@latest , my tailwindcss starts ...
-1
votes
0
answers
45
views
Using mutate inside debounce not triggering the API call?
export function useDebounce<T extends (...args: Parameters<T>) => void>(
callback: T,
delay = 300,
dependencies: React.DependencyList = []
): (...args: Parameters<T>) => ...
-4
votes
0
answers
36
views
Is there a way to add auto-transaction of crypto once wallet a Dapp connects to wallet? [closed]
I created a Dapp crypto website. I was able to connect to wallet and fetch wallet address successfully. But I tried to include some logics in other that once a wallet connects to the Dapp, it then ...
0
votes
0
answers
52
views
React Compiler says it is working but is not optimizing in real world example
I am adding React Compiler into our project. The compiler is shown in the devTools as working (the little stars emoji). But when I run a scenario with a component that could be optimized with useMemo ...
0
votes
1
answer
56
views
How to implement onclick function for a map made with React Leaflet
I have a map that I've made in React Leaflet which lets the user draw polygons, and i want the user to be able to click on the polygon and render a modal which lets the user name the area that's ...
Best practices
0
votes
12
replies
128
views
How to efficiently check array item exists in React context?
I am writing a library for Table rendering in React. I want that table to support row selection (each row has it's own checkbox).
I have created context for my table containing state of selected rows (...
-3
votes
1
answer
48
views
How to properly type a state array of objects in React with TypeScript? [duplicate]
I’m working on a React component using TypeScript and I’m trying to define a state variable that holds an array of objects. Each object represents a user with fields like id, name, and email.
import ...
-1
votes
0
answers
57
views
How should I resolve Minified React error #426? [closed]
Due to privacy concerns and the large amount of code involved, I’m unable to share all of the related code.
I would like to know how to resolve this issue so that it no longer throws an error. When ...
-6
votes
0
answers
104
views
How should I start structuring a full-stack project with React + Vite frontend, FastAPI backend, and PostgreSQL database? [closed]
I’m trying to understand the right way to start and organize a full-stack web app project from scratch.
For example, let’s say I want to build a web app using this stack:
Frontend: React + Vite
...
1
vote
0
answers
104
views
Promise's behaviour inside component without using `use` hook
In this example from react docs, I can remove use hook from const messageContent = use(messagePromise); leaving it like this const messageContent = messagePromise; and it still works (no error is ...
1
vote
0
answers
84
views
React not running anything with custom reconciler
I'm creating my own React 19 reconciler:
export class Reconciler {
get hostConfig(): ReactReconciler.HostConfig {
return {
getRootHostContext: notSupportedYet,
...
-2
votes
1
answer
45
views
Receiving object undefined on backend in socket.io [closed]
I am using ReactJS along with socket.io for building an application.
App.jsx
import { useState } from "react"
import io from "socket.io-client"
const socket = io.connect(...
-2
votes
0
answers
39
views
usestate dose'nt update immidiatly [closed]
I am trying to delete a block from a list of blocks and then update the list block ids using the index.
function handleKeyDown(e, id) {
if (e.code === 'Backspace') {
let blocksCopy = [...blocks];...
-4
votes
0
answers
57
views
Tailwind CSS padding and margin not working after adding to existing React project with manual CSS [closed]
I’m working on a React + Vite project where the existing styling is done using manual CSS files (many .css files in /src/styles).
Since maintaining many CSS files is becoming difficult as the app ...
-3
votes
0
answers
74
views
How to debounce API calls in React function component using useEffect and useRef?" [closed]
I'm trying to debounce an API call triggered by user input (e.g., search box) in a React function component. I want to avoid making a request on every keystroke and only call the API after the user ...
Best practices
0
votes
0
replies
37
views
Why does my Next.js app’s performance drop significantly when using dynamic routes with large datasets and server-side rendering (SSR)?
I'm working on a Next.js 14 app with several dynamic routes (e.g., /product/[id]) that render product details from a large dataset (around 50k+ records) stored in PostgreSQL.
I'm using ...
1
vote
1
answer
87
views
How to make part of a Zod schema optional only on submit?
I have a React project using TypeScript, React Hook Form, and Zod.
My Zod schema looks like this:
import { z } from 'zod';
export const loyaltyNmvFormSchema = z.object({
maxPoint: z.coerce.number()....
3
votes
1
answer
69
views
How to use CSS variables in a React.js component with TypeScript?
I'm new to React.js and want to set some CSS variables in an inline style attribute on a rendered component based on some calculations in JS.
When using TypeScript, it seems that I have to declare a ...
4
votes
1
answer
120
views
Type inference breaks when using two type mappings in one type
I have the code below.
import React from 'react';
type Button = React.ComponentType<{ size: 's' }>;
type Select = React.ComponentType<{ color: string }>;
declare const button: Button;
...
3
votes
1
answer
106
views
Getting 401 Unauthorized when calling Laravel Sanctum API after Inertia login (React + Laravel)
I'm using Laravel 11 with Jetstream (Inertia + React) and Sanctum for authentication.
Everything works fine when logging in via the default Inertia login page, but when I try to call a protected API ...
-4
votes
0
answers
47
views
How to handle HTTP request using React JavaScript [closed]
I am learning how to receive the inputs then call the backend service that has parameters (numberX, numberY, numberZ). This backend service calculates the entered inputs from client (there is no ...
3
votes
1
answer
50
views
window dimensions returns different things on chrome and firefox
I have this function to get windows dimensions that i use from different components to adjust my UI
The problem that i have is when using this on the smartphone, in firefox works great but in chrome ...
-4
votes
0
answers
56
views
Continuous playback of playlist queue in React-based app [closed]
I am in the middle of creating web based React player and struggling with implementing continuous playback of playlist queue.
Current logic:
The user clicks any playlist, a randomly selected track ...
-3
votes
0
answers
30
views
State not updating immediately after API response - how to access updated value? [duplicate]
I'm building a data validation form in React and fetching validation results from an API. The state updates, but when I try to use the value immediately after setState, it's still the old value.
...
-2
votes
0
answers
79
views
How to make an online TypeScript app repository on GitHub? [closed]
I have been trying for a bit of time to make a TypeScript + React app online, for a project, but I can't get the repository set up on GitHub. I now also have Node.js and want to know how I can set up ...
-2
votes
1
answer
35
views
Keyboard input and arrow navigation not working inside shadcn/ui menu content [closed]
Environment
React 18, TypeScript
shadcn/ui built on Radix UI (@radix-ui/react-dropdown-menu)
Shadow DOM host (open mode)
Also using cmdk for an input list inside the dropdown
Problem
When the app ...
1
vote
1
answer
47
views
react-barcode-scanner Not Scanning on Mobile
I’m using the react-barcode-scanner
package in a web-based React app. The camera opens and displays correctly on iOS Chrome, but it doesn’t detect or scan any barcodes.
The same exact component works ...
-5
votes
0
answers
64
views
AWS Location Service Map Works Locally But Fails in Production Build (Create React App) [closed]
I'm using AWS Location Service with MapLibre GL JS in my React application (Create React App). The map works perfectly in local mode (npm start), but fails when I create a production build (npm run ...
-4
votes
0
answers
46
views
React Native Background Service - In Kill mode [closed]
I’m developing a Walkie Talkie app in React Native, and I have a question —
How can I use a background service so that when one user speaks to another device:
If the other device is in kill mode, the ...
-3
votes
0
answers
34
views
React Bits Glassy Surface fails to build in server and Next JS [closed]
So I'm new to Next JS and I have critical server build problem. So I'm using React Bits in Next JS. So I'm using ` Glassy Surafce ` from the React Bits (https://reactbits.dev/components/glass-surface) ...
-3
votes
0
answers
36
views
How to centralize the use of Trans macro
I would like to centralize the use of Trans macro in my Typography component like so
type Props = {
styles?: StyleProp<TextStyle>;
children: string;
role: TextRole;
};
export const ...
3
votes
1
answer
85
views
useEffect is running a function an additional time instead of once per if statement
I have a modal. This modal opens after a user uploads a CSV. They can then make changes to the entries or delete them. The user can Confirm & Continue (go to next page, modal closes) or Upload New ...
-2
votes
0
answers
96
views
Why is my useEffect is not being triggered? There is no error message in console [closed]
I am working on a image drag application in React and the code works apart from my useEffect hook. I do not receive any error message, but the useEffect is never triggered.
When I console.log(...
-3
votes
0
answers
23
views
Why does my React useEffect run twice even with an empty dependency array? [duplicate]
I’m learning React and noticed that my useEffect hook runs twice even though I passed an empty dependency array ([]). For example:
useEffect(() => {
console.log("Effect runs");
}, []);
...