mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-11-12 22:05:49 +03:00
The normal advice is that `actionType` should be a string. This is purely for debugging purposes. If the tools used for debugging are altered, then it would be easier to use something other than a string.
Using a function means you don't have to have a separate action variable from the action creator itself:
```js
some someActionCreator = () => ({
type: someActionCreator,
})
```
Redux doesn't care if your action type is a string, object, symbol or whatever. Even @gaearon noted it should be a Symbol for uniqueness, but only said to use strings because of the debugging potential.
Another benefit of using functions is you're only comparing memory references rather than strings. This is a performance boost, but probably not one that will manifest in most applications.
We could even take this further to include `symbol.description` and `classInstance.constructor.name`.
The one downfall is most Redux tooling both utilizes and expects strings. This would need to change. Even `createReducer` would need to take a `Map` of actions instead of an `Object` or this wouldn't work.
|
||
|---|---|---|
| .. | ||
| d3tooltip | ||
| devui | ||
| map2tree | ||
| react-json-tree | ||
| redux-devtools | ||
| redux-devtools-cli | ||
| redux-devtools-core | ||
| redux-devtools-inspector | ||
| redux-devtools-instrument | ||
| redux-devtools-log-monitor | ||
| redux-devtools-test-generator | ||
| redux-devtools-trace-monitor | ||
| redux-slider-monitor | ||