question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting previous state on `onChange`

See original GitHub issue

bug 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:open
  • Created 6 years ago
  • Reactions:6
  • Comments:8

github_iconTop GitHub Comments

3reactions
FKSIcommented, Sep 13, 2017

@lmichailian I used a setTimeout hack 😉

1reaction
FKSIcommented, Sep 9, 2017

@lmichailian I don’t have access to the source code right now, I’ll check later 😉.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found