1.0.0 • Published 3 years ago
reactive-instance v1.0.0
reactive-instance
Why?
I don't know yet. At the least, It'd be nice to use an Object
object to represent form fields or something - and use that object's accessors instead of a setStateAction
function
Usage
class Details {
prop!;
field!;
}
//... in a component or custom hook
const details = useInstance(new Details());
details.prop = "some value"; // calls setState({prop: "some value"}) in the background
details.field = 90; // calls setState({field: 90})
const prop = details.prop; // calls state.prop;
Contribute
If you want.
1.0.0
3 years ago