# books

Source: https://developers.inkdrop.app/states/books

An [app state](https://developers.inkdrop.app/guides/flux-architecture) of notebooks in Inkdrop.
You can obtain the `books` state and integrate it with React components.

---

## Data Structure

- **all** (Array\<Book>)

  An array of [Book][book]s.
- **hash** (Record\<string, Book>)

  A map where the keys are `bookId` and values are [Book][book].
- **tree** (Array\<BookTreeItem>)

  An array of [Book][book]s 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 [Book][book]s.
- **lastUpdatedAt** (number)

  The last datetime when the state was changed.

Get the `books` state manually:

```js
const { books } = env.store.getState()
```

Connect the state with your React component:

```js
import { useSelector } from 'react-redux'
const selector = ({ books }) => books
const MyComponent = props => {
  const books = useSelector(selector)
  // render
}
```

[book]: https://developers.inkdrop.app/data-access/books
