Redux connect support
See original GitHub issueHi,
I have a React/Redux app that I’d like to document. With redux, I use the connect() function.
But when I use it, react-docgen cannot find a valid component in my file.
This works:
const Contributors = React.createClass({...});
export default Contributors;
This does not:
const Contributors = React.createClass({...});
const mapStateToProps = (state) => {
return { contributors: state.contributors }
}
export default connect(mapStateToProps)(Contributors);
I found a workaround by appending this to the end of file, but I don’t know if it will not break something later:
module.exports = Contributors;
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Connect | React Redux
The connect() function connects a React component to a Redux store. It provides its connected component with the pieces of the data it...
Read more >React Redux connect(): When and how to use it
In this guide, we've covered when and how to use the React Redux connect() API to create container components that are connected to...
Read more >React Redux Tutorials - 18 - connect - YouTube
React Redux Tutorials - 18 - connect ; Courses - https://learn.codevolution.dev/ ; Support UPI - https:// support.codevolution.dev/ ;
Read more >How, When, and Why to Connect() in React JS - Medium
connect ()method just provides a way for the user to connect the component to the redux store. It provides its connected component with...
Read more >5 Ways to Connect Redux Actions - Bene Studio
mapDispatchToProps […] If an object is passed, each function inside it is assumed to be a Redux action creator. An object with the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, actually I think this should be very doable.
When I get a chance I’ll give it a go and submit a PR
@rtsao:
That seems very reasonable to me, and I think it would even make sense to expand this to non-unary functions. The other arguments could be included in the output as well, as far as possible. Happy to review that PR 😃
@maximelebastard As an intermediate solution, if you can use the
findAllComponentDefinitions
resolver, which looks for all component definitions, not just the exported ones.