3 ms·
Use Symbols instead of Strings: https://www.keithcirkel.co.uk/metaprogramming-in-es6-symbols/ https://www.keithcirkel.co.uk/metaprogramming-in-es6-symbols... S
by ezpg 9y ago
Use Symbols instead of Strings: https://www.keithcirkel.co.uk/metaprogramming-in-es6-symbols/ https://www.keithcirkel.co.uk/metaprogramming-in-es6-symbols...
See the second line of the code snippet under "Symbols are completely unique…"
Unless I have misunderstood the spec, to compare symbols you require both the reference and value. Much more preferable than passing around Strings.
- acemarke 9y agoYou _can_ use Symbols for `action.type` in Redux, but that's discouraged, because they're not serializable and thus will not work properly with time-travel debugging. See http://redux.js.org/docs/faq/Actions.html#actions-string-constants http://redux.js.org/docs/faq/Actions.html#actions-string-con... .