Handle data change.
- Great Typescript support.
- Meant to be used with React.
// index.ts
import HandleDataChange from "handle-data-change";
type Data = { foo: string; bar: number };
const handleChange = new HandleDataChange<Data>(
{ foo: "adsf", bar: 0 },
data => {
console.log(data);
}
);
handleChange.change.bar(6);
handleChange.change.foo("hello world");
$ ts-node index.ts
{ foo: 'adsf', bar: 6 }
{ foo: 'hello world', bar: 6 }