Skip to content

Commit 16ecd00

Browse files
committed
Drop stage-2 and avoid using static class properties.
1 parent b4d89f8 commit 16ecd00

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"presets": [["env", { "loose": true }], "stage-2", "react"],
2+
"presets": [["env", { "loose": true }], "react"],
33
"ignore": ["node_modules", "stories.js"]
44
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"babel-preset-env": "1.7.0",
5151
"babel-preset-flow": "6.23.0",
5252
"babel-preset-react": "6.24.1",
53-
"babel-preset-stage-2": "6.24.1",
5453
"eslint": "5.11.1",
5554
"eslint-config-prettier": "3.3.0",
5655
"eslint-plugin-jest": "22.1.2",

src/Async.spec.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,11 @@ describe("Async", () => {
107107

108108
test("re-runs the promise when the value of 'watch' changes", () => {
109109
class Counter extends React.Component {
110-
state = { count: 0 }
111-
inc = () => this.setState(state => ({ count: state.count + 1 }))
110+
constructor(props) {
111+
super(props)
112+
this.state = { count: 0 }
113+
this.inc = () => this.setState(state => ({ count: state.count + 1 }))
114+
}
112115
render() {
113116
return (
114117
<div>
@@ -133,8 +136,11 @@ describe("Async", () => {
133136

134137
test("re-runs the promise when 'watchFn' returns truthy", () => {
135138
class Counter extends React.Component {
136-
state = { count: 0 }
137-
inc = () => this.setState(state => ({ count: state.count + 1 }))
139+
constructor(props) {
140+
super(props)
141+
this.state = { count: 0 }
142+
this.inc = () => this.setState(state => ({ count: state.count + 1 }))
143+
}
138144
render() {
139145
return (
140146
<div>

src/useAsync.spec.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ describe("useAsync", () => {
103103

104104
test("re-runs the promise when the value of 'watch' changes", () => {
105105
class Counter extends React.Component {
106-
state = { count: 0 }
107-
inc = () => this.setState(state => ({ count: state.count + 1 }))
106+
constructor(props) {
107+
super(props)
108+
this.state = { count: 0 }
109+
this.inc = () => this.setState(state => ({ count: state.count + 1 }))
110+
}
108111
render() {
109112
return (
110113
<div>
@@ -128,8 +131,11 @@ describe("useAsync", () => {
128131

129132
test("re-runs the promise when 'watchFn' returns truthy", () => {
130133
class Counter extends React.Component {
131-
state = { count: 0 }
132-
inc = () => this.setState(state => ({ count: state.count + 1 }))
134+
constructor(props) {
135+
super(props)
136+
this.state = { count: 0 }
137+
this.inc = () => this.setState(state => ({ count: state.count + 1 }))
138+
}
133139
render() {
134140
return (
135141
<div>

0 commit comments

Comments
 (0)