How to use @rooks/use-previous - 1 common examples

To help you get started, we’ve selected a few @rooks/use-previous examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imbhargav5 / rooks / packages / storybook / src / previous.js View on Github external
function UsePreviousDemo() {
  const myInput = useInput("hello world");
  const previousValue = usePrevious(myInput.value);
  return (
    <div>
      <div>
        <input>
      </div>
      <p>
        Current value is <b>{myInput.value}</b>
      </p>
      <p>
        Previous value was <b>{previousValue || "-"}</b>
      </p>
    </div>
  );
}

@rooks/use-previous

Access the previous value of a variable with this React hook

MIT
Latest version published 4 years ago

Package Health Score

59 / 100
Full package analysis

Popular @rooks/use-previous functions