December 2018
Intermediate to advanced
642 pages
15h 5m
English
Defining state is done by using class fields, a fairly new feature of JS, that's enabled via Babel since it isn't fully official yet. (See https://github.com/tc39/proposal-class-fields for the proposal, which is at Stage 3, meaning that it's one step away from being officially adopted.) With older JS versions, you would have had to create this.state in the class constructor, but this syntax is clearer. Let's remember what the code looked like, and let's drop the Flow definition.
First, let's modify the RegionsInformationTable component:
export class RegionsInformationTable extends React.PureComponent<...> { state = { countries: [ { code: "AR", name: "Argentine" }, { code: "BR", name: "Brazil" }, { code: "PY", name: "Paraguay" ...Read now
Unlock full access