Skip to content

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

Merged

Conversation

wgao19
Copy link
Contributor

@wgao19 wgao19 commented Oct 7, 2018

What does this PR do?

New doc piece regarding #1001:
Connect: Extracting Data with mapStateToProps

Summary of the changes

  • Fix a typo from Getting Started
  • Rename file GettingStarted.md to getting-started.md
  • Add the mapState piece and set it up on doc site accordingly

@netlify
Copy link

netlify bot commented Oct 7, 2018

Deploy preview for react-redux-docs ready!

Built with commit 9526155

https://deploy-preview-1036--react-redux-docs.netlify.com

`mapStateToProps` should be defined as a function:

```jsx
function mapStateToProps(state[, ownProps])
Copy link
Contributor

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.

Copy link
Contributor Author

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

@markerikson
Copy link
Contributor

I love it. MERGING!

@markerikson markerikson merged commit f930a76 into reduxjs:master Oct 7, 2018
albertodev7 pushed a commit to albertodev7/react-redux that referenced this pull request Dec 8, 2022
* 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
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

Successfully merging this pull request may close these issues.

2 participants