Skip to content

Update FAQ: Why should I use action creators? #2535

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

Merged
merged 5 commits into from
Jul 31, 2017
Merged

Update FAQ: Why should I use action creators? #2535

merged 5 commits into from
Jul 31, 2017

Conversation

maxhallinan
Copy link
Contributor

This adds a "Why should I use action creators?" section to the Actions FAQ. The answer is based on sources suggested in #1785 . cc: @markerikson

@maxhallinan maxhallinan mentioned this pull request Jul 28, 2017
<a id="structure-action-creators"></a>
### Why should I use action creators?

Action creators are superior to inline actions for several reasons.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rephrase this, and add a bit of extra info in here as well.

First, I'd say that action creators are not a required part of Redux, and you can dispatch actions directly from a component if you want, but they are a good practice for several reasons. (I'd also remove the phrase "superior to inline actions".)

Would also be nice if we can squeeze in a mention that they aren't "just" an idea with Redux, but that Redux inherited the idea from the original Flux architecture, per the Flux docs at https://facebook.github.io/react/blog/2014/07/30/flux-actions-and-the-dispatcher.html#actions-and-actioncreators .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! I agree - 'superior to inline actions' has an imperious tone I didn't intend.

@maxhallinan
Copy link
Contributor Author

@markerikson, I've expanded the first paragraph with your suggestions. Let me know what you think.

@markerikson
Copy link
Contributor

I like it. Stamped!

@markerikson markerikson merged commit 7bab9d4 into reduxjs:master Jul 31, 2017
@maxhallinan maxhallinan deleted the faq_action_creators branch July 31, 2017 19:04
@maxhallinan
Copy link
Contributor Author

Thanks for the merge!

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

Successfully merging this pull request may close these issues.

2 participants