Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

JavaScript Environment

JavaScript Runtime

When using React Native, you're going to be running your JavaScript code in up to three environments:

  • In most cases, React Native will use Hermes, an open-source JavaScript engine optimized for React Native.
  • If Hermes is disabled, React Native will use JavaScriptCore, the JavaScript engine that powers Safari. Note that on iOS, JavaScriptCore does not use JIT due to the absence of writable executable memory in iOS apps.
  • When using Chrome debugging, all JavaScript code runs within Chrome itself, communicating with native code via WebSockets. Chrome uses V8 as its JavaScript engine.

While these environments are very similar, you may end up hitting some inconsistencies. It is best to avoid relying on specifics of any runtime.

JavaScript Syntax Transformers

Syntax transformers make writing code more enjoyable by allowing you to use new JavaScript syntax without having to wait for support on all interpreters.

React Native ships with the Babel JavaScript compiler. Check Babel documentation on its supported transformations for more details.

A full list of React Native's enabled transformations can be found in @react-native/babel-preset.

TransformationCode
ECMAScript 5
Reserved Wordspromise.catch(function() {...});
ECMAScript 2015 (ES6)
Arrow functions<C onPress={() => this.setState({pressed: true})} />
Block scopinglet greeting = 'hi';
Call spreadMath.max(...array);
Classesclass C extends React.Component {render() { return <View />; }}
Computed Propertiesconst key = 'abc'; const obj = {[key]: 10};
Constantsconst answer = 42;
Destructuringconst {isActive, style} = this.props;
for…offor (var num of [1, 2, 3]) {...};
Function Namelet number = x => x;
Literalsconst b = 0b11; const o = 0o7; const u = 'Hello\u{000A}\u{0009}!';
Modulesimport React, {Component} from 'react';
Object Concise Methodconst obj = {method() { return 10; }};
Object Short Notationconst name = 'vjeux'; const obj = {name};
Parametersfunction test(x = 'hello', {a, b}, ...args) {}
Rest Paramsfunction(type, ...args) {};
Shorthand Propertiesconst o = {a, b, c};
Sticky Regexconst a = /o+/y;
Template Literalsconst who = 'world'; const str = `Hello ${who}`;
Unicode Regexconst string = 'foo💩bar'; const match = string.match(/foo(.)bar/u);
ECMAScript 2016 (ES7)
Exponentiation Operatorlet x = 10 ** 2;
ECMAScript 2017 (ES8)
Async Functionsasync function doStuffAsync() {const foo = await doOtherStuffAsync();};
Function Trailing Commafunction f(a, b, c,) {};
ECMAScript 2018 (ES9)
Object Spreadconst extended = {...obj, a: 10};
ECMAScript 2019 (ES10)
Optional Catch Bindingtry {throw 0; } catch { doSomethingWhichDoesNotCareAboutTheValueThrown();}
ECMAScript 2020 (ES11)
Dynamic Importsconst package = await import('package'); package.function()
Nullish Coalescing Operatorconst foo = object.foo ?? 'default';
Optional Chainingconst name = obj.user?.name;
ECMAScript 2022 (ES13)
Class Fieldsclass Bork {static a = 'foo'; static b; x = 'bar'; y;}
Stage 1 Proposal
Export Default Fromexport v from 'mod';
Miscellaneous
Babel Templatetemplate(`const %%importName%% = require(%%source%%);`);
Flowfunction foo(x: ?number): string {};
ESM to CJSexport default 42;
JSX<View style={{color: 'red'}} />
Object AssignObject.assign(a, b);
React Display Nameconst bar = createReactClass({});
TypeScriptfunction foo(x: {hello: true, target: 'react native!'}): string {};

Polyfills

Many standard functions are also available on all the supported JavaScript runtimes.

Browser

ECMAScript 2015 (ES6)

  • Array.from
  • md Array.prototype.{[find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find), [findIndex](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex)}
  • Object.assign
  • md String.prototype.{[startsWith](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith), [endsWith](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith), [repeat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat), [includes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)}

ECMAScript 2016 (ES7)

  • md Array.prototype.[includes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)

ECMAScript 2017 (ES8)

  • md Object.{[entries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries), [values](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values)}

Specific

  • __DEV__

Last updated: May 13, 2026