books

An app state of notebooks in Inkdrop. You can obtain the books state and integrate it with React components.


Data Structure

  • Name
    all
    Type
    Array<Book>
    Description

    An array of Books.

  • Name
    hash
    Type
    Record<string, Book>
    Description

    A map where the keys are bookId and values are Book.

  • Name
    tree
    Type
    Array<BookTreeItem>
    Description

    An array of Books with a tree structure. A Book that has child notebooks recursively has a children property. The children property follows the same structure as tree: an array of Books.

  • Name
    lastUpdatedAt
    Type
    number
    Description

    The last datetime when the state was changed.

Get the books state manually:

const { books } = inkdrop.store.getState()

Connect the state with your React component:

import { useSelector } from 'react-redux'
const selector = ({ books }) => books
const MyComponent = props => {
  const books = useSelector(selector)
  // render
}
Can you help us improve the docs? 🙏

The source of these docs is here on GitHub. If you see a way these docs can be improved, please fork us!