-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Symbols for constants #779
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
Comments
Action types should be serializable, and symbols are not. |
Yeah. You can do this technically but we don't encourage this because action types will disappear in the logs or if you persist them like Redux DevTools does. |
I've been thinking about using a little helper function that takes an array I wonder if it will make any difference in performance though. Probably not On Wed, Sep 23, 2015, 02:34 Dan Abramov [email protected] wrote:
Wout. |
@gaearon Thanks, I guess I would have noticed that if I were using the DevTools. Next on my list. |
@wmertens Did you mean something like this: https://www.npmjs.com/package/keykey ? |
@brandondewitt I was using Symbols to reduce the user-error of having action types with the same name. When it happens it can be hard to track (most times it's obvious). This may work if you need to keep your action types uniq:
It there a better way to handle this? |
@jjwill : That's probably going to be an issue for the same reason as symbols. See the Redux FAQ on action type constants for more info. There's a wide variety of utilities out there for generating action constants - check out the Actions and Action/Reducer Generators sections of my Redux addons catalog for links to libs that are out there. |
Thanks @markerikson I'll check those links out! The function above works for the debugging tools. We were using Symbols but after installing the debugging tools had to implement that for readability. |
I like the idea of using Symbols for action types...opinions?
The text was updated successfully, but these errors were encountered: