All Questions
Tagged with react-state javascript
524 questions
-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 ...
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 ...
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 ...
-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 ...
-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 ...
-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 ...
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 (
<>
...
-1
votes
1
answer
44
views
React state updates variable only when Chrome Inspect element is open [closed]
I've ran into a problem using React that there is a part of my code that only renders when the variable tipo assigned from useState gets a value. In my case the useState only updates the variable tipo ...
-1
votes
1
answer
51
views
Not successfully rendering state change after navigate() with react-router-dom
I have a problem with rendering a component after a performing a navigate with state to another page. Everything works as expected when I am already on the page that I am navigating to, but I would ...
0
votes
2
answers
37
views
NextJS - Update data object being passed into Child Component based on Button Click
I need to know how to update a data object based on a button click. This data object is being passed into a Child Component. When a user chooses an option in the dropdown menu, I want to populate that ...
-1
votes
1
answer
50
views
How can I update the UI immediately after adding a new todo in my MERN app without refreshing the page?
Body: I’m working on a MERN stack todo app and am facing an issue where the newly added todo doesn't immediately appear in the UI. The new todo only shows up after I refresh the page.
Issue:
After ...
-2
votes
2
answers
65
views
Using map loop in react showing not function [duplicate]
I am trying to map loop in React. Below is the json but it's showing map is not a function. How can I get data from api through map function like below the json?
{
"message": "...
-1
votes
1
answer
48
views
In which locations are you allowed to modify lifted-up state?
It is common in React to lift-up state and passing that state from parent to child, optionally together with a callback function allowing the child to signal to the parent that the state should change....
1
vote
1
answer
79
views
I have tried to implement search functionality in react, when I clear the input, I am not getting back the full list
The search functionality works but when I clear the input value, the complete list does not show up. I am using filter method for it, I am not understanding how can I get the full list back.
//search ...
0
votes
1
answer
66
views
Why is the state of my React useState hook constant being lost?
I am trying to build an info panel in React that shows three items of latest activity from an online community. Mainly the latest people who have signed up to the community.
I currently have a list of ...