How do you declare "const" in native-native?
Update 2015-10-23 : from React Native v0.13.0-rc is const
now included .
React Native JavaScript environment is not a browser, it uses JavaScriptCore instead . Anything not natively supported must be converted to a subset of JS supported by JavaScriptCore, and React Native uses Babel to do this.Here are the conversions that React Native uses (as of 2015-07-31):
ES5
- Reserved words: prom.catch (function () {});
ES6
- Arrow functions
- Call distribution
- Classes
- destructive
- Computed properties
- Object Consolidated method
- Concise object notation
- Rest params
- Template literals:
ES7
- Propagating objects
- Trailing Comma function
It's not immediately clear to me why constants are not included in this list, and it seems that support for overriding it is not quite ready yet:
source to share
The keyword is const
not currently supported in android action-native, I hope it will be available with the next version of action-native. The fix was trivial, for more details on the origins of the github issue .
source to share