Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
React-Hook Form and Little State Machine: Am I clearing up these states properly?

In this codesandbox, I can still see the previous values that were saved. However, if I'll use an incognito, the codesandbox is working properly. It does not show the previous values that were submitted.

This is the codesandbox: https://codesandbox.io/s/react-hook-form-data-in-step-1-and-step-2-editing-the-variable-names-wgv169?file=/src/Step2.js

Clearing up the state:

export default function clearAction(state, payload) {
  return {
    data: {}
  };
}

const Step2 = (props) => {
  const { state, action } = useStateMachine(updateAction, clearAction);
  const onSubmit = (data) => {
    action(data);
    action();
    push("/result");
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
    //input fields here
    </form>
  );
};
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!