| [ Web Proxy ] |
| Viewing: https://reactnative.dev/docs/javascript-environment | [Back] [Original] |
When using React Native, you're going to be running your JavaScript code in up to three environments:
While these environments are very similar, you may end up hitting some inconsistencies. It is best to avoid relying on specifics of any runtime.
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.
| Transformation | Code |
|---|---|
| ECMAScript 5 | |
| Reserved Words | |
| ECMAScript 2015 (ES6) | |
| Arrow functions | |
| Block scoping | |
| Call spread | |
| Classes | |
| Computed Properties | |
| Constants | |
| Destructuring | |
| forof | |
| Function Name | |
| Literals | |
| Modules | |
| Object Concise Method | |
| Object Short Notation | |
| Parameters | |
| Rest Params | |
| Shorthand Properties | |
| Sticky Regex | |
| Template Literals | |
| Unicode Regex | |
| ECMAScript 2016 (ES7) | |
| Exponentiation Operator | |
| ECMAScript 2017 (ES8) | |
| Async Functions | |
| Function Trailing Comma | |
| ECMAScript 2018 (ES9) | |
| Object Spread | |
| ECMAScript 2019 (ES10) | |
| Optional Catch Binding | |
| ECMAScript 2020 (ES11) | |
| Dynamic Imports | |
| Nullish Coalescing Operator | |
| Optional Chaining | |
| ECMAScript 2022 (ES13) | |
| Class Fields | |
| Stage 1 Proposal | |
| Export Default From | |
| Miscellaneous | |
| Babel Template | |
| Flow | |
| ESM to CJS | |
| JSX | |
| Object Assign | |
| React Display Name | |
| TypeScript | |
Many standard functions are also available on all the supported JavaScript runtimes.
requireconsole.{log, warn, error, info, debug, trace, table, group, groupCollapsed, groupEnd}XMLHttpRequest, fetch{set, clear}{Timeout, Interval, Immediate}, {request, cancel}AnimationFrameArray.fromArray.prototype.{find, findIndex}Object.assignString.prototype.{startsWith, endsWith, repeat, includes}Array.prototype.includes__DEV__| Web Proxy Viewer | New URL | Original Page |