Document usage of store.getState() in API
dmliao opened this issue · 1 comments
The API docs reference the function store.getState()
multiple times, but doesn't provide any documentation on how to obtain the store
object to call that function.
I found through trial and error that you can access the store
object in the following manner:
import { store } from 'mirrorx/lib/store';
...
store.getState();
This information should probably exist in the API page somewhere, as I don't think the store.js file in the source code is actually referenced anywhere beyond tests.
Yes you are right, The store
object is not explained in the API doc, because we thought it is obvious that most people are capable of figuring out what it is and what it means - the very object created by createStore
from Redux.
Since it is not exported, and more importantly, not encouraged to access it directly, we did not pay too much attention to explaining it. On the other hand, you do can import it through import { store } from 'mirrorx/lib/store'
, which is not demonstrated in the doc either - as I mentioned before, this kind of usage is not encouraged.
Nevertheless, thanks a lot for your kind remind, we'll refine the docs :)