Top "Class-fields" questions

How to use arrow functions (public class fields) as class methods?

I'm new to using ES6 classes with React, previously I've been binding my methods to the current object (show in …

javascript arrow-functions ecmascript-next class-fields
How do I make a "public static field" in an ES6 class?

I'm making a Javascript class and I'd like to have a public static field like in Java. This is the …

javascript ecmascript-6 class-fields
Correct use of arrow functions in React

I am using ReactJS with Babel and Webpack and using ES6 as well as the proposed class fields for arrow …

javascript reactjs arrow-functions ecmascript-next class-fields
ES6 Classes: Unexpected token in script?

I'm copying an example trying to learn ES6 but i'm getting a compile error: Unexpected token (2:5) It appears to be …

javascript ecmascript-6 class-fields
Declare a class property outside of a class method

See how x and y are declared in constructor: class Point { constructor(x, y) { this.x = x; this.y = y; } …

javascript ecmascript-6 class-fields
eslint Parsing error: Unexpected token =

Why is eslint throwing this error? The Javascript runs without issue inside of React Native. The code was taken from …

javascript reactjs react-native eslint class-fields
Eslint - `Parsing error: unexpected token =` error for assigned fat arrow / property initializer

I'm using an arrow function and it's complaining about a parsing error: Parsing Error: Unexpected token = However my code is …

ecmascript-6 eslint class-fields
How to avoid bind or inline arrow functions inside render method

We should avoid method binding inside render because during re-rendering it will create the new methods instead of using the …

javascript reactjs arrow-functions function-binding class-fields
Eslint does not allow static class properties

I'm current developing an API on Node 12.14.1 and using Eslint to help me write the code. Unfortunately it does not …

javascript node.js eslint class-fields
unexpected token = for class properties in node 8.4

running the following code in node (v8.4) class TodoStore { todos = []; get completedTodosCount() { return this.todos.filter( todo => todo.completed === …

javascript node.js es6-class class-fields