this?
function myFunc(obj) {
produce(obj, (draft) => {
// but I have only access here
console.log(draft)
});
}
I want in the end myFunc((draft) => console.log(draft))
what
I edited now
This is a classic case of callback composition: function myFunc(obj, cb) { produce(obj, (draft) => { cb(draft); }); } myFunc(obj, (draft) => console.log(draft));
You can also generalize it
Not sure what meant by this, but I will try if it works
Обсуждают сегодня