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

27 questions
0
votes
0 answers

is it possible to wrap a hook in another hook

I'm trying to work out how to change the behaviour of an existing hook, specifically the useAsync hook provided by the react-async library. It's a hook for making async requests to an API. I'd like to change the behaviour of the hook in a number of…
jonhobbs
  • 21,469
  • 23
  • 94
  • 144
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
1 answer

React-Async call run later with GET request on useFetch

I am trying to run a fetch request later by using useFetch from the React-Async library. I would like to run it in an effect hook. import React, {useEffect} from 'react'; import { useFetch } from "react-async" const Example = (props) => { const…
poiuytrez
  • 18,348
  • 28
  • 100
  • 156
0
votes
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
  • 860
  • 10
  • 29
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
  • 924
  • 1
  • 12
  • 32
0
votes
1 answer

react-async v. 8.0.0 - using new promise prop w/ Typescript & optimistic updates

I just updated to the newest version of react-async (8.0.0) and the new promise prop is giving me some trouble. I'm trying to use the promise prop after my useAsync hook, as described in the release notes, but I'm getting a runtime error "TypeError:…
Kat Tow
  • 3
  • 2
0
votes
1 answer

Reactjs waiting for array.forEach completion before continued with callback

I've only been using JS and React for a short time, and am running into issues with waiting for a forEach loop to complete before continuing. The function glitchLib below should pull an array of img sources from state, iterate through the elements…
Khan
  • 11
  • 2
0
votes
1 answer

React – Async / Await doesn’t seem to be waiting

I had previously posted this problem under the error message of “Cannot read property 'data' of undefined”. But in the process of digging into it for several hours, I’ve discovered that my problem really boils down to the fact that my “async /…
0
votes
0 answers

React Native async fetch JSON, but abstracting to a separate component

My app has a button which fetches JSON api results, and updates that in a TEXT field. Works fine. import React, { Component } from 'react'; import { View, Text, StyleSheet, Button } from 'react-native'; export default class HomeScreen extends…
Jammo
  • 1,021
  • 2
  • 15
  • 32
0
votes
1 answer

react-async-script implementation: wrapping a component

I am trying to wrap a react component that requires the google maps api, with a makeAsyncScriptLoader from react-async-script. In the same file (if that makes a difference): class SearchBar extends Component { /* Some stuff requiring the maps…
Alex
  • 1,583
  • 20
  • 41
0
votes
1 answer

How to snapshot and reject data in react-redux?

This's my first react and redux project. I'm try to learning by doing from main redux repo's examples and i can't find an example for todomvc async in that repo. Finally i've found an excellence tutorial about redux todomvc async and i'v added this…
Dos
  • 771
  • 9
  • 23
-2
votes
2 answers

react.js -jquery method does not work

The app uses node.js and react.js (namely react-async ). So there is a react component that has a click handler inside which I want to get the class names(namely minus_decrement and inline_block) of that component. I used jQuery inside node.js…
Istiaque Ahmed
  • 4,977
  • 17
  • 59
  • 117
1
2