Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 425 Bytes

default-value.md

File metadata and controls

17 lines (15 loc) · 425 Bytes

Default values

Define a default value for the Selector using options in last argument. Selector value property will have that value until real value is ready

const booksAndAuthors = new Selector(
  [booksCollection, authorsCollection],
  booksAndAuthors => ({
    books: booksAndAuthors[0],
    authors: booksAndAuthors[1]
  }),
  {
    defaultValue: []
  }
);
console.log(booksAndAuthors.read.value); // []