Guide / JavaScript /

Register your first object

To start working with dop the first thin we have to do is register an object or a class instance with the initial state of our APP. Arrays are not allowed.

const state = dop.register({
    todos: [],
    completedCount: 0
})
console.log(state.todos.length) // 0

Register will return an ES6 Proxy object. Basically, we have created an observable object where can be observed when mutates.

For a more detailed documentation have a look register

Next step

Create an observer