Insert Items

RefinerDB wants to know your full set of items (prior to any filtering, sorting, or paging).

You can pass your items to the RefinerDBProvider or you can call setItems on the RefinerDB instance provided by useRefinerDB.

// Option 1: Pass items to the RefinerDBProvider
<RefinerDBProvider
  name="movies"
  items={movies}
  indexes={movieIndexes} >
  <YourStuff />
</RefinerDBProvider>

// Option 1b: Pass items to the RefinerDBProvider
// and specify the primary key
<RefinerDBProvider
  name="movies"
  items={movies}
  {/*  If you don't pass an `idProperty` RefinerDB will assume it is "id". */}
  idProperty="movieId"
  indexes={movieIndexes} >
  <YourStuff />
</RefinerDBProvider>

// Option 2: Set items explicitely
// Assumes your component is already
// wrapped with a `RefinerDBProvider`.
let refinerDB = useRefinerDB();
refinerDB.setItems(movies);
let refinerDB = new RefinerDB("bookmarks", { idProperty: "__id" });

If you are using refinerdb-react, you can pass the items to the RefinerDBProvider or you can set them explcitely using the useRefinerDB hook.