Can we have an alias function that is called createActionCreator()?
christopher-francisco opened this issue · 3 comments
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 anobject
- an
action creator
is afunction
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.
totally agree with this.
👍
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';
@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.