ES6 and ES7 features without babel transpiling in react-native?
Asked Answered
L

1

6

I would love to use Javascript ES6 and ES7 syntax (especially async/await, my new best friends) without transpiling. Is that even an option? And should it be an option?

It all depends on the sub-question: what Javascript engine does react-native effectively use, on Android and iOS? Is it taken from the device itself? (in which case transpiling IS the only option...) Or is it provided by React Native?

Logomachy answered 22/12, 2017 at 0:29 Comment(2)
ES7 (ES2016) only introduced two new features. async/await is part of ES2017.Piragua
Very true, it never made it into 2016. Gonna have to start using + after version names...Hirsh
H
2

You can happily use async/await in React Native (you've been able to for awhile, in fact... since 0.10). As to using it without transpiling, that's a slightly stickier question. React Native requires only Node v6 and above, so obviously there's a fair bit of transpiling done via Webpack/Babel in order to ensure it still works with older versions of Node.

The deployed environment on the device is JavaScriptCore (see JavaScript Environment for more details). While you're debugging, you're using V8 via Chrome.

Hirsh answered 22/12, 2017 at 2:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.