Export redux exports
See original GitHub issueI think it is a better developer experience when binding libs export the exports from the “core” lib. For instance, right now it is common to see developers import from redux and react-redux in the same component:
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
This is extra typing, which makes it a little less convenient to use Redux. Additionally, it can be difficult to remember what comes from which library. I have it memorized now, but I used to always use trial and error to figure out where to import things from.
It would be less code to write, and easier for developers to learn and use redux, if the above was:
import { connect, bindActionCreators } from 'react-redux';
React Router does this, and it is 👌:
import { Router, Link } from 'react-router-dom';
Router
comes from the react-router package, and Link
comes from react-router-dom.
In other words, web users do not need to install react-router and react-router-dom. Redux could have a similar developer experience.
Thanks for reading ✌️
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
We maintain both
redux
andreact-redux
, but they are separate packages.I don’t see a real need for this. Besides, in most cases, you shouldn’t have to import things from both libraries in the same file. If you’re using
bindActionCreators
when connecting a React component, I’d encourage you to use the “object shorthand” form ofmapDispatch
instead:That binds them automatically.
The only other Redux export that you might be using here is
compose()
for combining multiple HOCs together, and that’s a rarer use case.I had no idea you could do that! That’s pretty rad ✌️
I agree with you @markerikson . This isn’t an issue given you can pass an object as that argument to
connect
.Thanks for responding!