GenericUnit
// initialization
const unit = new GenericUnit({initialValue: ['π ']}); // value is ['π ']
typeof unit === 'object' // true
unit instanceof Array // false
unit.value() instanceof Array // true
// adding an item to the stored array value
unit.dispatch(arrValue => [...arrValue, 'π'])
// this is inefficient compared to ListUnit.push, but it works
// dispatching a different type of value
unit.dispatch('not an array') // works
// dispatching a different type of value
unit.dispatch(true) // worksLast updated
Was this helpful?