Skip to content

v2.0.0

Latest
Compare
Choose a tag to compare
@crazko crazko released this 12 Mar 20:22
· 1 commit to master since this release

Added

A complete rewrite. Now it is possible to set initial value and/or set new value to be the same as the previous one.

API is similar to React's useState, it returns a tuple:

import { useDencrypt } from "use-dencrypt-effect";

const Example = () => {
  const [value, setValue] = useDencrypt("initial value");

  return <div onClick={() => setValue("new value")}>{value}</div>;
};

It is also possible to import just core function and use it without React:

import { dencrypt } from "use-dencrypt-effect";

const setValue = dencrypt({
  initialValue: "initial value",
  callback: (value) => {
    element.textContent = value;
  },
});

Changed

  • Migrated to Vite and Vitest.

Full Changelog: v1.0.2...v2.0.0