Incapsulate state managment inside particular scope
const sum = dis((sum, n) => sum + n, 0)const scope1 = diScope({sum})const scope2 = diScope({sum})scope1.sum(1)scope1.sum(4)scope1.sum() // 5scope2.sum(3)scope2.sum(7)scope2.sum() // 10 Copy
const sum = dis((sum, n) => sum + n, 0)const scope1 = diScope({sum})const scope2 = diScope({sum})scope1.sum(1)scope1.sum(4)scope1.sum() // 5scope2.sum(3)scope2.sum(7)scope2.sum() // 10
Optional
Incapsulate state managment inside particular scope
Example