-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Docs/extracting data with mapstate #1036
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
Docs/extracting data with mapstate #1036
Conversation
Deploy preview for react-redux-docs ready! Built with commit 9526155 |
`mapStateToProps` should be defined as a function: | ||
|
||
```jsx | ||
function mapStateToProps(state[, ownProps]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the TS/Flow syntax for optional arguments? I've seen the square-bracket syntax used for years with other languages and such, but wondering how helpful it is and how many people recognize that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In FlowType it would look like:
/* @flow */
type State = Object; // type for state
type Props = Object; // type of ownProps
type StateProps = Object; // type of StateProps
type mapStateToProps = (state: State, ownProps?: Props) => StateProps
I love it. MERGING! |
* Fix typo and remove unnecessary comments from `GettingStarted.md` * Rename getting started to kebab * Add mapState piece * Restructure the mapState page content * Tweak sidebar title and add memoization note
What does this PR do?
New doc piece regarding #1001:
Connect: Extracting Data with
mapStateToProps
Summary of the changes
GettingStarted.md
togetting-started.md
mapState
piece and set it up on doc site accordingly