Questions tagged [react-async]

Related to sync feature of React.js

Related to sync feature of React.js: https://reactjs.org/

https://reactjs.org/docs/getting-started.html

37 questions
1
vote
2 answers

How to rerender function component when id changed in url

I have a React component that fetches some data from IndexedDB that is an asynchronous task it uses the id from the url passed in by the useParams hook, let say id = 1. When I click on the link in the example the id changes to 2 but at this point…
Smek
  • 1,158
  • 11
  • 33
1
vote
0 answers

React - Force Reload Of Component

In my component - I am calling out to a service class that performs an async call. I pass a callback to the service and use that when the async call is complete. Is it possible to force a reload of the component from this callback…
Damien Gallagher
  • 535
  • 1
  • 6
  • 16
1
vote
0 answers

revise jquery ajax into native react methos

how can I remove the jquery-ui ajax in react for some other ajax method. I am fetching data from json file and need to show the data in the html page. var app = React.createClass({ loadAppData: function() { $.ajax({ async: false, …
0
votes
0 answers

How can i async await in setting fetchOptions in a createClient function in urql

I want to fetch the token from async-storage but it returns a Promise of type string or undefined. Since fetchOptions is a function that returns a object of type RequestInit here is what i've tried export const client = createClient({ url, …
crispengari
  • 7,901
  • 7
  • 45
  • 53
0
votes
0 answers

Why does the return data of a function useAsync appear undefined?

We tried to obtain weather data, but tried with the react-async library to determine the return value of this asynchronous function. However, the status is always displayed as pending and no data is defined. Can you tell me why? // The parameter…
최석규
  • 46
  • 5
0
votes
1 answer

How to keep the selected option form dropdown still visible in dropdown

I have a dropdown of 3 items and if I select one of the items, the dropdown displays remaining 2 items, so I wanted it to display all 3 despite of the selected values. reference dropdown As per the reference image, polo shirt is selected so I want…
0
votes
0 answers

Creating a dynamic api calling async react-select

I want to create a react-select drop-down where typing the input triggers an API call which asynchronously updates my options. Here's what I have tried so far : const [keyWord, setKeyWord] = useState(''); const [searchOpt, setSearchOpt] =…
0
votes
2 answers

Updating FlatList data with useState infinitely recurs in React Native

I'm trying to set the data for a flatlist with useState, but updating the state causes the component to re-render, so it calls the getInventory function again and infinitely recurs, crashing the app. I'm using a function component, not class. If I…
0
votes
2 answers

Correct Way to Update Sate before Async call

I am trying to update state to show an ActivityIndicator while an asynchronous call is being made. What is the correct way of doing this to ensure IsLoading(true) and setResult(null) will happen before the the async call? In the code below…
gavinest
  • 308
  • 2
  • 12
0
votes
1 answer

How can I add image elements to my page dynamically?

My React app is connected to Firebase Firestore and Storage, and I'm having trouble with reading the files from Storage and displaying them. At one point, I have the following array of data: metricData = [ "2021-07-15" = { id1: "/image1url", id2:…
Sharon
  • 3,471
  • 13
  • 60
  • 93
0
votes
1 answer

Tracking how far a user has scrolled in a React Native flatlist

I'm working on an IOS app in React Native right now, and we present our content feed to the user as a flatlist that they can scroll through. I need to keep track of how far they have scrolled into that flatlist so that I know which posts they have…
0
votes
1 answer

Caught Error error while using useEffect react native HOOks

so i am trying to use async storage and trying to validate if their is data in Async or not.. here is my code here is the error i am not able to validate through...
0
votes
2 answers

Is there a way to await changes in state? (not setState)

I want to await for changes in shared state and act on those, so: function Foo() { const [bar, setBar] = useContext(myContext) const someHandler = async () => { doSomething() while(true) { await stateDidChange(bar) …
Rollie
  • 4,391
  • 3
  • 33
  • 55
0
votes
0 answers

How to apply Google Distance Matrix Service efficiently in React Redux?

I'm fetching list of orders containing delivery vehicle's current location and order's destination and storing list in Redux Store. Currently I've implement distance matrix service in a component and executing it in App.js file and passing each…
0
votes
0 answers

Invalid hook call error with react async select

Invalid hook call. Hooks can only be called inside of the body of a function component. I am trying to create a hook to load options in react-select. Here's my code - import React, { useEffect } from "react"; import { useDispatch } from…
Arjita Mitra
  • 962
  • 2
  • 13
  • 36