ecmascript-next Questions

2

Solved

I've seen code using Javascript classes use the following form (example is React): class UserProfile extends Component { state = { open: false } handleOpen = () => { this.setState({ open:...
Pompon asked 7/6, 2017 at 22:47

1

Solved

I am attempting to import everything from a library as a hash, modify it, and re-export the modified hash, without knowing all of the named exports in a library. For example: import * as reactBoot...

2

Solved

I've started a project where I use React JS for the front end an node js in backend. I used webpack for bundling up JS files. I used babel along with other necessary stuff. When I use arrow f...
Pitapat asked 30/12, 2016 at 15:28

1

Solved

I would like to know if there is a clean way to set the value of a key from a string variable when using spread syntax in es6? Something like the following: let keyVar = 'newKey' let newObj...
Blakney asked 22/12, 2016 at 22:18

1

How can I override a constructor with an ES7 class decorator? For example, I'd like to have something like: @injectAttributes({ foo: 42 }) class Bar { constructor() { console.log(this.foo); } ...
Jocelyn asked 25/11, 2016 at 0:17

6

Given var arr = [1,2,true,4,{"abc":123},6,7,{"def":456},9,[10]] we can filter number items within array arr using Number constructor var res = arr.filter(Number); // [1, 2, true, 4, 6, 7, 9, A...
Halfhearted asked 26/3, 2016 at 6:57

2

I have: const props = { gallery: [], select: () => null, one: 1, two: 2, } I can destructure it with: const {gallery, select, ...other} = props I will have three variables now: galle...
Iloilo asked 3/11, 2016 at 10:22

0

I have 2 very related questions. One practical, relating to a real problem I have, and one more theoretical. Let me start with the latter: Q1: Does async/await + generators make sense? In g...

2

There are a lot of questions/articles written on the numerous ways to handle binding in ES6 React, but most don't seem to address a problem outlined in the React docs (emphasis mine): We recomme...
Graduate asked 5/6, 2016 at 19:28

1

Solved

Their is already a question on this topic Node.js Best Practice Exception Handling which is old and answers are very much outdated, domains have even deprecated since then. Now in a post Async/...
Garate asked 23/9, 2016 at 7:26

1

Solved

I have a ES7 code like this. async function returnsfive() { var three = 3; var threeP = await three; return threeP+2; } returnsfive().then(k=>console.log(k), e=>console.error("err", e)) ...
Balmuth asked 10/8, 2016 at 22:29

1

Solved

Having var obj = { a: 1, b: 2}; What are the differences between obj = Object.assign(obj, { c: 3}); And obj = {...obj, c: 3 };
Rhizotomy asked 19/7, 2016 at 14:55

1

Solved

I just want to wait for a process to finish, not want to make the function asynchronous. See the below code. I had to make getUserList asynchronous because there was an await keyword in the functio...
Annal asked 12/7, 2016 at 5:23

1

Solved

I have some use cases for inheritance and decoration (as in Decorator pattern) of components and directives in Angular 2. The example is component with basic template that doesn't suit the case, t...

1

I have the following setup: { "babel-core": "~5.8.25", "babel-eslint": "^4.1.3", "babel-loader": "~5.3.2", "babel-polyfill": "^6.2.0", "eslint": "^1.7.3", "eslint-config-airbnb": "^0.1.0", ...
Recept asked 8/2, 2016 at 11:43

6

Solved

When I'm launching my project using React-Native default packager, I have this error: Unexpected token on this line: static propTypes = { /// ... }; I took a look on React-Native issues on Git...
Librate asked 9/11, 2015 at 18:16

2

I have an ES2015 class that connects to a remote service. The problem is that my code tries to access this class before its object has finished connecting to the remote server. I want to ensure t...
Shippee asked 27/3, 2016 at 1:5

1

Solved

import {Component, ...actions} from '../MyModule'; Seems to be throwing a linting error. Is there a reason why you can't "spread" on an ES6 import statement?
Princedom asked 8/3, 2016 at 8:22

1

For instance, why does the function below need to have "async"? Isn't using await specific enough for the compiler to parse the code without ambiguity? // Why do we need async here?...
Ridgeling asked 26/2, 2016 at 16:5

1

Solved

I'm getting used to the proposed async/await syntax and there's some unintuitive behavior. Inside the "async" function, I can console.log the correct string. However, when I try to return...
Pericope asked 11/2, 2016 at 11:11

1

Solved

The only place it seems to be documented is this issue thread and the actual specification. However, the reasoning for the removal isn't posted anywhere I could find. The new recommended way seems...
Vedis asked 3/2, 2016 at 3:42

2

Solved

I'm trying to understand better what an async function in JavaScript is technically, even if I basically know how to use them. Many introductions to async/await make belive that an async function ...
Frizzle asked 12/1, 2016 at 9:30

2

Solved

given these two classes class Foo{ f1; get f2(){ return "a"; } } class Bar extends Foo { b1; get b2(){ return "a"; } } let bar = new Bar(); What code will get me this list of propert...
Minnesota asked 7/1, 2016 at 20:19

3

Solved

I see decorators being used today already in some javascript code. My question is really two fold. First: If decorators have not even been finalized how is it possible to use them in production c...

1

Solved

I'm running into an issue which I don't fully understand. I feel like there are likely concepts which I haven't grasped, code that could be optimized, and possibly a bug thrown in for good measure....
Putnam asked 19/12, 2015 at 0:30

© 2022 - 2024 — McMap. All rights reserved.