handleActions naming is confusing
See original GitHub issueSince handleActions
returns a reducer, a proper name for it would be createReducer
. I’ve tried to teach redux to a friend and it wasn’t immediately apparent that handleActions
returns a reducer. What do you think? I’m not adamant on createReducer
, as it doesn’t differentiate from handleAction
. I just think that handleActions
might not be the proper name for it.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:15 (2 by maintainers)
Top Results From Across the Web
redux-actions handleActions isn't changing the state
You are passing map with wrong keys to handleActions . You don't want keys to be SET and CLEAR , but their values...
Read more >Redux Best Practices - Medium
Structure and Naming. Use Ducks. Note: Dan does not endorse ducks because it may confuse beginners into thinking actions map 1:1 to reducers....
Read more >handleAction(s) - redux-actions
If a reducer function is passed, it is used to handle both normal actions and failed actions. (A failed action is analogous to...
Read more >Transfering states in react - JavaScript - The freeCodeCamp Forum
handleAction , a class method in Parent. It is being passed in (on the left side) in the prop “handleAction”. I gave the...
Read more >REST Resource Naming Guide
To avoid this confusion, use hyphens (-) instead of underscores ( _ ). http://api.example.com/inventory-management/managed-entities/{id}/install ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Recommendations: A better name for createAction is actionCreator since it generates an actionCreator A better name for handleActions is actionReducers since it generates reducers.
This lines up with existing naming conventions: http://redux.js.org/docs/basics/Actions.html - Action Creators http://redux.js.org/docs/basics/Reducers.html - Reducers handle Actions
The react-redux-starter-kit just added the ‘redux-actions’ names to its module/counter file as it turned 1.0 recently, and as someone new to Redux I would agree that the naming of ‘redux-actions’ was not intuitive and it was significantly different than the Redux example projects. Only the comments made it clear what each was.
I’d add on this. Let’s take this code straight from the documentation:
let increment = createAction('INCREMENT');
Any person that would see this for the first time would assume that
increment
is now an action. Well… bad news,increment
is now an action creator therefore an actually descriptive name forcreateAction
in this case would becreateActionCreator
, which reminds me of this: http://bash.org/?946461.Please come up with some proper names 😞.