Pass properties to super in derived classes. Fixes #289

Thanks!
This commit is contained in:
Peter Blazejewicz 2018-02-03 15:54:36 +01:00 committed by Steve Sanderson
parent 6b44610079
commit 3d118de0d5
2 changed files with 4 additions and 4 deletions

View File

@ -3,8 +3,8 @@ import React, { Component } from 'react';
export class Counter extends Component { export class Counter extends Component {
displayName = Counter.name displayName = Counter.name
constructor() { constructor(props) {
super(); super(props);
this.state = { currentCount: 0 }; this.state = { currentCount: 0 };
this.incrementCounter = this.incrementCounter.bind(this); this.incrementCounter = this.incrementCounter.bind(this);
} }

View File

@ -3,8 +3,8 @@ import React, { Component } from 'react';
export class FetchData extends Component { export class FetchData extends Component {
displayName = FetchData.name displayName = FetchData.name
constructor() { constructor(props) {
super(); super(props);
this.state = { forecasts: [], loading: true }; this.state = { forecasts: [], loading: true };
fetch('api/SampleData/WeatherForecasts') fetch('api/SampleData/WeatherForecasts')