stats
An app state that represents the statistics of the database.
You can obtain the stats
state and integrate it with React components.
Data Structure
- Name
notes
- Type
- number
- Description
The total number of notes in the database.
- Name
pins
- Type
- number
- Description
The number of pinned notes.
- Name
tags
- Type
- { [tagId]: number }
- Description
The number of notes associated with each tag, where keys are
tagId
and values are note counts.
- Name
books
- Type
- { [bookId]: number }
- Description
The number of notes in each notebook, where keys are
bookId
and values are note counts.
- Name
status
- Type
- { [status]: number }
- Description
The number of notes with each status, where keys are status types and values are note counts.
Get the stats
state manually:
const { stats } = inkdrop.store.getState()
Connect the state with your React component:
import { useSelector } from 'react-redux'
const selectStats = ({ stats }) => stats
const MyComponent = props => {
const stats = useSelector(selectStats)
// render
}
Example stats data:
{
"notes": 141,
"pins": 4,
"tags": {
"tag:HyBgJ94gx": 12,
"tag:Hyg5Cyoaz": 1,
"tag:ZiQET3lID": 3,
"tag:cBDJ4lFfE": 10,
"tag:h11OMPbSs": 3,
"tag:sxSqVKdRv": 15,
"tag:tBELDUITs": 1,
"tag:tutorial": 3
},
"books": {
"book:-wDNxxN_a": 28,
"book:0cFae6lCc": 6,
"book:Bk5Ivk0T": 6,
"book:HJWHS7SMZ": 15,
"book:SkTsOceR": 9,
"book:XxhoCNo8u": 3,
"book:first": 66,
"book:kKNHqOr6z": 3,
"book:tjnPbJakw": 5
},
"status": {
"none": 115,
"active": 16,
"onHold": 5,
"completed": 4,
"dropped": 1
}
}