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

Any 1.x to 2.x differences guide yet? #103

Open
srcspider opened this issue Apr 8, 2016 · 5 comments
Open

Any 1.x to 2.x differences guide yet? #103

srcspider opened this issue Apr 8, 2016 · 5 comments
Labels

Comments

@srcspider
Copy link

No description provided.

@Yomguithereal
Copy link
Owner

Allow @srcspider. I haven't had time to write such a guide, but the differences are quite few: Just know that the higher-order function has seen its arguments swapped, that you don't have to provide an object with the cursors and actions key, but just the cursors and that a dispatch props is passed to the component as a mean to dispatch the actions.

@Zache
Copy link
Contributor

Zache commented May 6, 2016

While I've basically never used it actions used bind to set the tree as this, this no longer happens with dispatch. I'm curious as to if there is any reason for this change?

@Yomguithereal
Copy link
Owner

The reasons are the following:

  • I was tired to have to specify the functions several times, in the higher-order function configuration and in the component's body.
  • This allows potential redux-like actions in the future if this is ever needed.

@psypersky
Copy link

I used to use async actions as

this.props.actions.sendMessage(text)
.then((res) => this.setState({ sendingMessage: false }));

I guess this will force me to send all the state to the tree instead of leaving some state in the components

@Yomguithereal
Copy link
Owner

It's a bit strange to have a component with mixed local & external state but I see your point. Maybe I can make the dispatch function return the result of you action so you can access your Promise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants