State
Definition
function State(initial: any) {
return {
update: function,
get: function,
onUpdate: function
}
}Input
Takes initial of any type
Returns an object
update(value: any): updates the current state with the input valueget(): returns the current stateonUpdate(value: function): takes a callback function and calls the function whenever the state is updated
Last updated