Skip to content

Grabbing state from the tree

Christian Alfoni edited this page Mar 5, 2015 · 1 revision
var Baobab = require('baobab');

var tree = new Baobab({
  todos: []
});

// We create a cursor
var todos = tree.select('todos');

// We can create a cursor to non existing data too
var notifications = tree.select('notifications');

// Grabbing data
todos.get(); // []
notifications.get(); // undefined