Skip to content

Commit 496c9ca

Browse files
committed
🚀 fixed the stopPolling and startPolling function binding to this
1 parent 37a6594 commit 496c9ca

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/ReactPolling.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ import PropTypes from 'prop-types';
1414
render={({ startPolling, stopPolling, isPolling }) => {
1515
if(isPolling) {
1616
return (
17-
<div> Hello I am polling</div>
18-
<Spinner />
17+
<div>
18+
<p>Hello I am polling<p>
1919
</div>
2020
);
2121
} else {
2222
return (
23-
<div> Hello I stopped polling</div>
24-
</div>
23+
<div>Hello I stopped polling</div>
2524
);
2625
}
2726
}}
@@ -157,14 +156,14 @@ export class ReactPolling extends React.Component {
157156
render() {
158157
if (this.props.render) {
159158
return this.props.render({
160-
startPolling: this.startPolling,
161-
stopPolling: this.stopPolling,
159+
startPolling: this.startPolling.bind(this),
160+
stopPolling: this.stopPolling.bind(this),
162161
isPolling: this.state.isPolling
163162
});
164163
}
165164
return this.props.children({
166-
startPolling: this.startPolling,
167-
stopPolling: this.stopPolling,
165+
startPolling: this.startPolling.bind(this),
166+
stopPolling: this.stopPolling.bind(this),
168167
isPolling: this.state.isPolling
169168
});
170169
}

0 commit comments

Comments
 (0)