question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Asynchronous data fetching / other effects

See original GitHub issue

Hey, first of all thank you for releasing this - looks great so far! šŸ™‚

I have gotten a basic app working now, with some placeholder interactions. Now I would like to show some ā€œlive dataā€ in the Home Tab, and was wondering if there was an example for this or if you had any hints. My attempts either resulted in stale state, that was only refreshed after another interaction, or lots of requests triggered that didnā€™t do anything at all šŸ™ˆ

Something like ā€œsend a GET request on load, fetch data, show result to userā€. In a normal React app Iā€™d use useEffect(() => fetch(requestTarget).then(data => setState(data)), [requestTarget]) or something like that and Iā€™d expect that to cause an update of the view. However that didnā€™t seem to work for me šŸ¤”

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
maxchehabcommented, May 4, 2020

Closing this for #19

0reactions
tejasmanoharcommented, May 2, 2020

Ah yeah, that seems reasonable-- canā€™t think of a case that doesnā€™t cover off hand

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use async functions in useEffect (with examples)
Data fetching means using asynchronous functions, and using them in useEffect might not be as straightforward as you'd think. Read on to learnĀ ......
Read more >
How To Handle Async Data Loading, Lazy Loading, and Code ...
Step 1 ā€” Loading Asynchronous Data with useEffect. In this step, you'll use the useEffect Hook to load asynchronous data into a sampleĀ ......
Read more >
Redux Fundamentals, Part 6: Async Logic and Data Fetching
Familiarity with using AJAX requests to fetch and update data from a server; Understanding asynchronous logic in JS, including PromisesĀ ...
Read more >
Asynchronous Data Queries - Recoil
Asynchronous Data Queries. Recoil provides a way to map state and derived state to React components via a data-flow graph. What's really powerful...
Read more >
Suspense for Data Fetching (Experimental) - React
This page focuses on the data fetching use case, but it can also wait for images, scripts, or other asynchronous work. What Is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found