ds300/derivablejs

Example code not work

sphynx79 opened this issue · 5 comments

Hi,

i try to use this simple code in derivable 2.0.0-beta.3, i take this code from documentation

import { derive, atom, setDebugMode } from "derivable"
setDebugMode(true)

const x = atom(4)
const times = (a, b) => a * b
const xTimesTwo = x.derive(times, 2)

console.log(xTimesTwo.get())

but result is NaN

until version 2.0.0-beta.1 this code work fine

Additional arguments support was removed. Use function scope instead.
371012e

const x = atom(4);
const times = (a, b) => a * b;
const xTimesTwo = x.derive((x)=> times(x,2));

in this way

Yep, this way.

also if i preferer old way!!

Thanks.

Docs is a bad side of this project. If you would like to help with it I'm open for questions.