Top "Es6-class" questions

This tag is for questions regarding Classes in Ecmascript 6. The tag is only for classes provided in the Ecmascript version.

Serializing an ES6 class object as JSON

class MyClass { constructor() { this.foo = 3 } } var myClass = new MyClass() I'd like to serialize myClass object to json. One easy way …

javascript json ecmascript-6 es6-class
Javascript ES6 - Enums inside classes used outside like a static enum

I'd like to ask if it's possible to add an enum similar to: STATES = { WIP: "Work in progress", ONLINE: "Online", …

javascript class enums ecmascript-6 es6-class
Typescript : underscore convention for members

I have a class Email class Email { private _from: string; private _to: Array<string>; private _subject: string; } It'll …

javascript typescript ecmascript-6 typescript2.0 es6-class
"Class extends value #<Object> is not a constructor or null"

Thanks for reading my post I get this error on my code : "Class extends value # is not a constructor or …

javascript es6-class
javascript 'this' in ES6 classes return undefined

I think this is a scope problem, but I'm not sure how to fix this. Here is my code: http://…

javascript ecmascript-6 es6-class
Conditional export in ES2015

Let's say you're developing a polyfill and don't want to shim a class if it already exists in the browser. …

javascript ecmascript-6 es6-class es6-modules
ES6 Classes - Calling methods from a click event

I am new to ECMA classes. In the following code, I have built a button class that is working fine. …

javascript ecmascript-6 es6-class
TypeError: Attempted to wrap undefined property as function

The example below is simplified. I have a getter method: class MyClass { constructor() {} get myMethod() { return true; } } which is processed …

ecmascript-6 sinon babeljs es6-class
Why cant react set initial state based on props

I have a es6 react component that I want the initial value of the state to depend on that of …

reactjs ecmascript-6 state es6-class react-fiber
React-router : how to pass "match" object into a component declared as an ES6 class?

I'am new to react-router (v4) and I was following the tutorial until this little problem : This code works quite well …

es6-class react-router-v4