All Questions
6 questions
2
votes
1
answer
922
views
In React, why do we call this in arrow function?
I have a question.. please let me know..
import React, { Component } from "react";
class App extends Component {
constructor(props) {
super(props);
}
handleClick = () => {
...
8
votes
2
answers
6k
views
Classes and arrow functions and THIS [closed]
While learning JS and React I've come across confusing differences in tutorials.
I'll split the questions below with examples. I understand bind for regular functions and this context, it's just ...
0
votes
2
answers
83
views
Why methods as arrow functions work in react classes but not in normal classes?
We can declare methods of component class as arrow functions, like so:
class SomeComponent extends React.Component {
someMethod = () => { // <<----- This does not throw error
// some ...
10
votes
5
answers
10k
views
ES6 functions, arrow functions and 'this' in an ES6 class [duplicate]
class App extends Component {
constructor(props) {
...
}
onChange = (e) => this.setState({term: e.target.value})
onSubmit(e){
e.preventDefault();
const api_key = "...
1
vote
0
answers
32
views
Does React Hot Loader preserve 'this'?
As far as I could check the code, hot loader creates a new component and replaces the component in the DOM with the new component. The state is passed from the old component to the new one.
How does ...
1
vote
1
answer
917
views
In create-react-app, my component won't compile because a static arrow function comes back undefined
I have the following React component. I'm using create-react-app, which is supposed to support static class fields, but this does not compile and, instead throws this error:
./src/scenes/Settings/...