Reputation: 2187
Where could I find the list of ES6 features taht are ready to use in React Native?
Eg Object.assign().
Upvotes: 4
Views: 5794
Reputation: 1212
It's depends on what JSX done (see this table). You can use Babel for more ES6 feature, this post maybe helps.
[EDIT] According this official doc, full support table is here:
// Reserved Words:
promise.catch(function() { });
// Arrow function:
<C onPress={() => this.setState({pressed: true})}
// Call spread:
Math.max(...array);
// Class:
class C extends React.Component { render() { return <View />; }
// Destructuring:
var {isActive, style} = this.props;
// Iteration:
for (var element of array) { }
// Computed Properties:
var key = 'abc'; var obj = {[key]: 10};
// Object Consise Method:
var obj = { method() { return 10; } };
// Object Short Notation:
var name = 'vjeux'; var obj = { name };
// Rest Params:
function(type, ...args) { }
// Template:
var who = 'world'; var str = `Hello ${who}`;
// Object Spread:
var extended = { ...obj, a: 10 };
// Function Trailing Comma:
function f(a, b, c,) { }
Upvotes: 6
Reputation: 3107
React Native is using the Babel transpiler - the features it enables are all of Babel Core, plus whatever is whitelisted in /packager/transformer.js
.
Upvotes: 1