question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[react-redux] MapStateToProps and MapDispatchToProps missing alternate types

See original GitHub issue

React Redux allows MapStateToProps to be:

  • a function that returns:
    • an object
    • a function that itself returns an object

and allows MapDispatchToProps to be:

  • an object
  • a function that returns:
    • an object
    • a function that itself returns an object

The previous version of the libdef, flow_v0.54.x-v0.61.x/react-redux_v5.x.x.js, included each of these types (with the exception of MapDispatchToProps’ function that returns a function that returns an object). In the current version, flow_v0.62.0-/react-redux_v5.x.x.js, both MapStateToProps and MapDispatchToProps include only:

  • a function that returns:
    • an object

Was there a reason for the alternate types’ omission?

Also, shouldn’t props/ownProps be declared optional?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lukeapagecommented, Mar 20, 2018

@gantoine please can you fix the tags on this issue?

0reactions
AndrewSouthpawcommented, May 2, 2018

Responding on the PR… 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

MapDispatchToProps causes Typescript Error in parent ...
Now in my parent component Typescript is telling me that it is missing the properties that I defined in PropsFromDispatch. This doesn't seem ......
Read more >
Connect | React Redux
The mapStateToProps and mapDispatchToProps deals with your Redux store's state ... connect accepts four different parameters, all optional.
Read more >
react-redux: type error for connect inside HOC #31363 - GitHub
I tried using the @types/react-redux package and had problems. ... connect( mapStateToProps, mapDispatchToProps )(Counter); const ...
Read more >
Typescript Tips Series: Proper Typing of react-redux ... - Medium
The StateProps and DispatchProps types are nice to have, as they help to catch errors in the mapStateToProps and mapDispatchToProps methods at ...
Read more >
3 ways to test mapStateToProps and mapDispatchToProps
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; // Component 1 - "Base component" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found