Getting previous state on `onChange`
See original GitHub issuebug report
What is the current behavior?
I am getting the previous form values on a onChange
What is the expected behavior?
I’d like to get the current form values on a onChange
Other information
formLights: pickBy(
getFormValues('psDashboard')(state),
(value, key) => startsWith(key, PS_LIGHT_ID_PREFIX)),
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:8
Top Results From Across the Web
how does a onChange handler get access to the previous ...
It's not actually the state value from the previous render cycle, it's the current state value being passed as an argument to the...
Read more >Changing state using previous state in onChange function
Say I try to do the below in a function passed into an onChange function: const onChange = (e) => { setState(state.concat([e.target.value])) }....
Read more >How to change the state of react component on click?
We have to set initial state value inside constructor function and set click event handler of the element upon which click, results in...
Read more >Lifting State Up - React
React calls the function specified as onChange on the DOM <input> . · The handleChange method in the TemperatureInput component calls this.props.
Read more >Accessing previous props or state with React Hooks
Example: Getting the previous props or state; Custom Hook with the usePrevious Hook; useRef in depth: An overlooked React Hook ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lmichailian I used a
setTimeout
hack 😉@lmichailian I don’t have access to the source code right now, I’ll check later 😉.