Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey
-1 votes
1 answer
38 views

React - component state variable value not updated when used in handler, which passed to child

I try to make some kind of infinite scroll Here is my CodeSandbox setup (first approach) To paginate I made some kind of cursor which keeps last loaded item id in after state variable I use that after ...
bankangle's user avatar
-1 votes
0 answers
37 views

Why is state stale in my socket.on listener?

Please can someone tell me why the consumers variable is an empty object inside my user disconnected listener. It is clear that the state in the consumers variable is stale because the JSX maps ...
sam's user avatar
  • 1
0 votes
1 answer
77 views

Shadcn/cmdk cannot bind to command input component

I'm trying to compose my own Combobox component using Shadcn ui. In doing this I am using the Command component. I am trying to bind my command input value to React state in Next.js client component ...
Ethan's user avatar
  • 1,773
0 votes
1 answer
75 views

How to re-render table to reflect input data

I have two files/components: Createrisk.jsx for creating individual risks Tablepage.jsx displays the risks in an MUI Data Grid The problem is Tablepage renders only the attributes from Createrisk ...
Aleks3000's user avatar
0 votes
0 answers
52 views

Re-renders when clicking Copy Clipboard button

I am using monaco-editor and I created a code preview. In the previewer, I want to copy the contents, but everytime I click my copy button, it always rer-renders. What am I missing? or How should I ...
master shifu's user avatar
-1 votes
1 answer
49 views

Data Table won't render instantly even after useEffect triggered

I am using DataTables in a NextJS project. I'm getting data from the backend with: const [rows, setLocalRows] = useState([]); useEffect(() => { if (Array.isArray(initialRows)) { setLocalRows(...
mbakgor's user avatar
  • 35
0 votes
1 answer
28 views

LocalStorage Value Not Resetting Daily When User Closes the Page

I'm building a React app where I store a boolean value (hasGuessed) in localStorage. This value should reset to false every day at midnight. Currently, I'm using setTimeout to schedule the reset at ...
user29783777's user avatar
-1 votes
4 answers
97 views

Attempting to use a loading state to stop undefined data

So I know that the data used in a setState call won't be updated until the next render and have looked up plenty to figure out what to do about that. The best solution I kept finding was to use a ...
Tapialj's user avatar
  • 345
0 votes
4 answers
97 views

Not able to sort an array of objects initiated using the useState hook

I have an array of items declared using the useState hook: const [items, setItems] = React.useState([{id: 1, title: "Example Item"}, {id: 2, title: "Another example item"}]) I ...
Harish's user avatar
  • 528
-1 votes
1 answer
40 views

State is reverting to it's initial state even after calling state updater function

The code written below is from the functionality file, I was building a notes app and wanted to add a folder option too to categorize all the notes but while displaying the changing/adding notes to a ...
Aman Kaushik's user avatar
-1 votes
2 answers
61 views

Event Handeling in react hooks

I am trying to make a form using ReactJS. What I am confused about is how the useState hook handles the change event if I use google autofill to fill all the input fields simultaneously? Here in the ...
Amritansu Aditya's user avatar
0 votes
0 answers
19 views

Profile Details not rendering after refreshing the page, data is not stored in the state [duplicate]

I am very new to React coding, I have encountered an issue which I am unable to resolve. The issue is; after logging in, the page will redirect to the profile details. For login, it's working fine and ...
SUMANTH REDDY's user avatar
-1 votes
1 answer
72 views

Can't understand why my useState variable is not showing the initial value nor the updated value

I got it now. sessions was initially rendering as an empty array. I added a useEffect function to update the useState variable. I'm trying to remove the deleted element from the UI without having to ...
Karen's user avatar
  • 195
-1 votes
1 answer
48 views

React custom hook issues [duplicate]

I am new to React. I have created a custom hook in react for fetching the data from api. Below is the code. import { useState, useEffect } from 'react'; import useAxiosInstance from './...
Gate Study's user avatar
0 votes
2 answers
63 views

React: Why does the value of my input not update, but outputting the same same state to the page or console does?

Here is my code: import { useState } from "react"; const Testing = () => { const [testa, setTesta] = useState({ Nickname: "Testing" }); return ( <> ...
Jives's user avatar
  • 23

15 30 50 per page
1
2 3 4 5
88