Comments (5)
@fjacobs the response is always returned to the onSuccess handler so you can use that and then set your own local component state. For example in a twitter feed example you can have a local component with this.state = { feeds: [] } and on every polling success you might append the new tweets to this feed.
I hope that answers your question.
from react-polling.
@K3CK Thank you for the kind words and sorry to see it not working as expected.
Can you try with the latest release v1.0.5?
That should fix your issue and startPolling, stopPolling should work as expected.
Let me know if you still face any issues.
from react-polling.
Thanks for your fast response. But unfortunately it throws now a different error:
Warning: Cannot update during an existing state transition (such as within
render). Render methods should be a pure function of props and state.
And
Uncaught Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
from react-polling.
can you create a codesandbox link for me to check?
from react-polling.
I have a stupid question: I was wondering how do I get the body of the response in your example:
if(isPolling) {
return (
<div> Returned json: ? </div>
);
} else {
return (
<div> Hello I stopped polling</div>
);
}
from react-polling.
Related Issues (7)
- Polling empty responses? HOT 3
- Support for dynamic URL HOT 5
- Allow it to provide a context to access the poller to force poll
- Do startPolling and stopPolling accept custom implementation as well? HOT 2
- Multiple react-polling components HOT 1
- Feature Request: Add support for providing a promise directly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-polling.