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

Can we have an alias function that is called createActionCreator()? #339

Open
christopher-francisco opened this issue Jan 17, 2019 · 3 comments

Comments

@christopher-francisco
Copy link

christopher-francisco commented Jan 17, 2019

Docs says about the createAction function:

NOTE: The more correct name for this function is probably createActionCreator(), but that seems a bit redundant.

In my opinion this is not redundant. This is important. It creates confusion and it takes me extra time to clear out the unnecessary confusion when talking to redux to somebody new to it (Yes, not everybody that join a project has allocated time to just study redux).

The confusion I'm talking about is:

  • an action is an object
  • an action creator is a function

So when they go an see that createAction returns a function, they think that the function is the action and end up wrapping it up in another function, making a mess.

My point is, let's just have an alias (so that it's backward compatible) so that whoever wants can use createActionCreator instead of createAction. Also I'd love not have to hack this into my project.

@christopher-francisco christopher-francisco changed the title can we have an alias function that is called createActionCreator()? Can we have an alias function that is called createActionCreator()? Jan 17, 2019
@ShaneZhengNZ
Copy link

totally agree with this.

@dorian-marchal
Copy link

👍

We just started with Redux and some coworkers are already calling action creators "actions" due to createAction.

Maybe you can do this as a work around:

import { createAction as createActionCreator } from 'redux-actions';

@christopher-francisco
Copy link
Author

@dorian-marchal this workaround works, in a technical sense. However, think about a newbie ramping up to the project and see that all of the redux js files have has createAction aliased as createActionCreator, they ask "why?"

Then you have to go ahead and explain the problem with the current name, why is it confusing, and why we chose to go with an alias.... sounds more confusing to me.

An official alias should be the solution.

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

3 participants