Skip to main content
-1 votes
1 answer
39 views

Why is this useEffect causing infinite rerenders?

I am trying to create a useEffect hook that will check my firebase database for an array of objects when the component loads or when there's an update to the array. My problem is that it's causing ...
Cranky Dragon's user avatar
1 vote
1 answer
24 views

Why attendence Context fetching again on navigation back to the teacherattend component?

I need to use attendance data often on my website, So I make it as utility as below: import React, { useState, useEffect, useMemo, useCallback, createContext } from 'react'; import { ...
BI IYI's user avatar
  • 11
1 vote
1 answer
32 views

React Accessing another component’s DOM nodes

Going through react.dev learning tutorial, I noticed something not quite right about accessing another component’s DOM nodes. https://react.dev/learn/manipulating-the-dom-with-refs#accessing-another-...
nammae88's user avatar
1 vote
1 answer
41 views

useState issue with axios instance in React [duplicate]

I have the following React component, it works very weird! Everyhing inside useEffect hook is correct (console.log shows correct value of the instance), but After calling setApiInstance with the newly ...
masoud khanlo's user avatar
2 votes
3 answers
41 views

How to use useState, Dispatch input?

Consider this code: const [seconds, setSeconds] = useState<number>(START_VALUE); useEffect(() => { const intervalId = setInterval(() => { setSeconds((previousSeconds) => ...
mehran's user avatar
  • 1,466
-1 votes
1 answer
24 views

What are the potential consequences of not returning clearTimeout? [duplicate]

The question is asking about the potential negative effects of not returning the value returned by the clearTimeout() function in JavaScript. import { useEffect, useState } from 'react'; function ...
vinayak singh's user avatar
0 votes
0 answers
68 views

i try to logout from my dashboard components, it stuck on dashboard with loading and all the dashboard content remove

Here is my code to get the dashboard form backend using useEffect and then the handler to handle the logout button After few time if I reload the page then its redirected the login page. import React, ...
Emperor's user avatar
  • 11
1 vote
1 answer
27 views

Material UI: DataGrid server-side pagination flickering data when using swr

I want to display server-side paginated data on a Material UI DataGrid with data fetched using swr. I've been working through MUI's introduction example for server side data in DataGrid which is using ...
RipeFruit's user avatar
1 vote
2 answers
41 views

React Redux: Login Form Flickers on Page Refresh Despite User Being Authenticated

I'm building a React application using Redux for state management. My app checks if the user is already logged in by fetching authentication data from localStorage and dispatching it to Redux. However,...
MwahMallah's user avatar
-1 votes
0 answers
17 views

can't show data on my custom react native picker

I have try to make custom Picker for my app . all are working fine but when i click on Category it show list of item but when click on that it did not retrieve data to show replace Category to ...
Rocky Sain's user avatar
-1 votes
1 answer
21 views

Why does my React useEffect hook run multiple times even with an empty dependency array? [duplicate]

I'm working on a React project and encountering an issue with the useEffect hook. My goal is to fetch data from an API only once when the component mounts. However, the useEffect seems to run multiple ...
Ravindra Kumar's user avatar
-1 votes
0 answers
15 views

React complains about different number of hooks used while switching between routes

I'm trying to implement MVVM pattern in my React application. Let's assume for simplicity that the project structure looks as follows: src/ - mvvm-stuff/ - ... - Component1/ - Component1View.tsx ...
VIPPER's user avatar
  • 340
0 votes
1 answer
42 views

How to unit test a form using the useActionState hook?

I want to test a form with the useActionState hook. It does use simply async function, not a server action. I would like to assert the state to be incremented, but the test fails even before I can ...
Mist's user avatar
  • 1,187
-1 votes
2 answers
43 views

Conditionally using custom React hooks?

I have two custom React hooks that fetch different data and parse it. Both hooks return an object of the same type. I have a component that displays that data and depending on a "variant" ...
Mora Obradovic's user avatar
1 vote
2 answers
56 views

How to call a callback prop when another prop changes without omitting useEffect dependencies?

I have a simple dialog component that takes an open prop to control whether the dialog is shown or not, and an onOpen prop which is a callback to be run every time the dialog opens. I can achieve this ...
DanielGibbs's user avatar
  • 10.2k

15 30 50 per page
1
2 3 4 5
2048