Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document usage of store.getState() in API #101

Open
dmliao opened this issue Oct 6, 2018 · 1 comment
Open

Document usage of store.getState() in API #101

dmliao opened this issue Oct 6, 2018 · 1 comment

Comments

@dmliao
Copy link

dmliao commented Oct 6, 2018

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.

@llh911001
Copy link
Member

llh911001 commented Oct 8, 2018

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants