Skip to main content

All Questions

-1 votes
0 answers
19 views

React useState update optimization // general Dataflow optimization

I have build an application for scheduling shifts. My problem is now that with a few more employees the performance suffers. It is currently acceptable, but I want to futureproof my system. React ...
Jemx's user avatar
  • 43
-1 votes
0 answers
36 views

Why is my React state behaving unpredictably?

I'm working on a Typescript React app with next.js where the user can have many projects, and I'd like them to be able to delete a project. I've set up these components that accommodate that: a ...
Cole's user avatar
  • 9
1 vote
2 answers
39 views

Stopping a timer in React by meeting a condition (instead of with a "stop" button)

I've built a simple stopwatch with start and stop buttons. I've also built a really barebones matching game where a user clicks on 5 different squares that start out as random colors (possibility of ...
user24713855's user avatar
0 votes
1 answer
42 views

Extracting and aggregating a state of lower components / Avoiding rendering

I have a question regarding react state. I'm still a beginner but - I have a table with three columns. In two of these, I have input fields. I set it up each row is a component and has its own state. ...
Radek Chlud's user avatar
0 votes
2 answers
38 views

React Asynchronous states Problem - state in Context set to true but remains false in the component (React authentication with Context and API call)

I have a problem with asynchronous states on React I use context to determine whether the admin is authenticated and has the right to access a page with a state called isAuth interface UserContext { ...
Max123456's user avatar
0 votes
0 answers
31 views

ReactJs Handling Css Animation Using Classes Between Parent and Child

I'm having an issue when trying to handle Css Animation in a ReactJs App. I'm using Classnames to trigger the Css Animations (a bit excessive but mostly just for testing) #messagesWrapper { position: ...
TheLovelySausage's user avatar
0 votes
2 answers
34 views

React : useState not updating object state keys as expected

I have a form with many input elements and a button which goes on next page. Before moving forward it validates all the inputs in such a way that if any it is empty then the corresponding label should ...
Pradhyumn Sharma's user avatar
0 votes
0 answers
65 views

Change react-hook-form input value with custom hook [duplicate]

For a registered input, I failed to update it using my own custom hook. In my sample codes as shown below, the result2 didn't set to "bar" when the button was clicked, although r2 was ...
len's user avatar
  • 394
1 vote
1 answer
37 views

Edit object in array directly in React is working but use hooks is not

import { useState } from "react"; type Rule = { value: string; valid: boolean; }; type RuleComponentProps = { rule: Rule; setValue: (value: string) => void; setValid: (valid: ...
Jack Zhang's user avatar
  • 2,726
-1 votes
1 answer
29 views

useCallback is recreate function when variable is not in dependency list

Hello I have a Login modal where I also have function onSubmit, it's next js application. So it's changing state of setIsLoading, then it's recreating component, but not the function? Am I right?. ...
IGODX's user avatar
  • 13
0 votes
2 answers
71 views

Stale state inside an event handler

I have a JS library (Cytoscape) inside my React component. The library need to be handled events with set event handler functions (on diagram/ component initilazation). The problem is that inside ...
Chen Peleg's user avatar
  • 1,580
1 vote
1 answer
33 views

React CSS Transition Not Triggering for Specific Elements After State Update

I'm working on a simple React application that involves moving tiles on a board. The application uses CSS for animations and React state to track the tiles' positions. I have a transition function ...
its9527's user avatar
  • 15
0 votes
2 answers
78 views

Getting different behavior between useState() and useRef() + useState()

I am getting different behavior between the two code blocks when I believe they should be the same. My goal is to update compass heading using watchHeadingAsync and perform and animation from the ...
akremer's user avatar
  • 125
0 votes
0 answers
21 views

AG Grid cell validations are not updating when rows are updated

Use Case: I'm using AG Grid to render tables. I have to disable 'Save' button when there is no data in 2 cells(called conditions, terms) in a particular row. Issue: I've created my own Select ...
nymphadora's user avatar
0 votes
2 answers
66 views

storing previous states of a hook

I want to print the current and previous value of a state, I have a piece of code that does the job function App() { const [value, setValue] = useState(""); const prevValue = useRef('') ...
cheems's user avatar
  • 224

15 30 50 per page
1
2 3 4 5
27