Comments (4)
#29862
The issue arises because the useEffect hook depends on both value1 and value2, causing the value not to update properly. By removing the dependencies on value1 and value2, the component functions correctly.
from react.
Hi
from react.
@Sunilverma99 you're inspecting the wrong values there. This issue is specifically around the defaultValue
that is set so when a form is reset the values are not correct. If you inspect the element you can get a better example of what is happening here. All other input types will have the html attributes change except type=number
![Screenshot 2024-06-11 at 1 01 17 PM](https://private-user-images.githubusercontent.com/1565184/339414278-b230e94f-fc83-4796-a7a8-d74e979ecd73.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzMjI2NzksIm5iZiI6MTcyMTMyMjM3OSwicGF0aCI6Ii8xNTY1MTg0LzMzOTQxNDI3OC1iMjMwZTk0Zi1mYzgzLTQ3OTYtYTdhOC1kNzRlOTc5ZWNkNzMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MThUMTcwNjE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWZkZWQ3YWIxMzRiOTRhNDZmNTE3YjJjNTI4YzE3ODMwMjFlNmI5NjNkMzU5ZTE1YThmZGQyNjUxNTM1MjA0MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.7A2FyhTbz3krZJR86kINzTCeW6sOMYeZOwpqVxa3Mqk)
from react.
https://codesandbox.io/p/github/BrendonSled/react-19-controlled-input-number-bug/new-example
This might be a better example of the exact issue I'm facing. If you input hit the enter key while focused in the number input the field value will be erased on the form submit even though the state is still the old value.
from react.
Related Issues (20)
- [React 19]
- ..
- [DevTools Bug]: 5.2.0 is not available for Firefox HOT 2
- [DevTools Bug] getCommitTree(): Invalid commit "1" for root "445". There are only "1" commits.
- [eslint-plugin-react-hooks] Missing type declarations HOT 2
- [React 19]
- Bug: useEffect is triggered even if the array as dependency variable wasn't changed. HOT 4
- [DevTools Bug]: React Devtools not working neither on vite or cra project HOT 5
- ..
- Bug: Error Recovery Mechanism Overwriting Initial Rendering Errors in Concurrent Mode HOT 1
- Bug: Empty `style={}` object values cause hydration warnings in React 18.3.1 - Includes solution
- [React 19] Cannot assign to readonly property HOT 8
- Unexpected Initial State Jump in 'useEffect" with 'setTimeout' and State Dependencies HOT 3
- React[19] Module '"react"' has no exported member 'useActionState'. HOT 2
- Bug: effect runs with stale state values outside of Concurrent React HOT 1
- Feature Request: ESLint hooks rule for accessing previous state when deriving new state
- Bug: Weird Behavior of useCallback() hook When Variables or States Are defined before and after the Callback (ES5) HOT 5
- Bug: div: `ref` is not a prop HOT 2
- Bug: useFormStatus pending state is reset when component state is updated HOT 3
- [React 19] TEST HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.