Skip to content
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

redux-polyglot 1.0.0 #79

Open
guillaumearm opened this issue Apr 14, 2017 · 1 comment
Open

redux-polyglot 1.0.0 #79

guillaumearm opened this issue Apr 14, 2017 · 1 comment
Milestone

Comments

@guillaumearm
Copy link
Collaborator

guillaumearm commented Apr 14, 2017

due to #77 and other issues, I think it's time to plan to do some breaking changes.

My first idea is to change the actual translate component enhancer in order to support all react-redux features.

In addition, I think that using a function named `translate' to connect a component to a redux store is a bit confusing

I propose a mapStateToProps enhancer which can be named withPolyglot :

connect(
  withPolyglot('my_scope')(mapStateToProps),
  mapDispatchToProps,
  mergeProps,
  options,
)(Component);

// example without scope
withPolyglot()(mapStateToProps);

// example without mapStateToProps;
withPolyglot('myScope')()

// example without scope and mapStateToProps
withPolyglot()();

Edit:

The usual case will be something like that :

const mapStateToProps = withPolyglot()(state => ({
  a: getA(state),
  b: getB(state),
}))

export default connect(mapStateToProps)(Component);
@guillaumearm guillaumearm added this to the v1.0 milestone Apr 14, 2017
@guillaumearm
Copy link
Collaborator Author

@satazor @JalilArfaoui @jvincent42 : your opinions are welcome

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

No branches or pull requests

1 participant