Calls the function that was passed in State.of
const state = of(() => {
console.log('a')
return [null, null]
})
state.run(null) // Output: 'a'
const state = of((num: number) => [num * 2, num])
const mapped = state.map((num) => num * 10)
console.log(mapped.run(50)) // Output: [1000, 50]
const state = of((num: number) => [num * 2, num])
const mapped = state.flatMap((num) =>
of((n) => [n, num]),
)
console.log(mapped.run(50)) // Output: [50, 1000]