Questions tagged [react-suspense]
194 questions
0
votes
1 answer
Pass props to axios hook that implements react suspense
i have been trying to create a hook that fetches data and takes advantage of react suspense.
Using the example in the page (and this article) I have created a function(i want to convert it to hook) that fetches data.
Example
Here on…
0
votes
1 answer
React Suspense not working when fallback component is imported
I have made a LoaderPage component that looks like this
import theme from "../../assets/styles/globalStyles"
import Loader from "react-loader-spinner"
import React from "react"
import styled from "styled-components"
const Background = styled.div`
…

Aakash Verma
- 3,705
- 5
- 29
- 66
0
votes
1 answer
How do the React.lazy(), Suspense value received and add to state variable numbers
How can we use React.lazy() and Suspense in the below example. I am getting random value from FirstComponent.js. How do I use FirstComponent value to add to newNumber and display the total. So while rendering each time, we should get different total…

soccerway
- 10,371
- 19
- 67
- 132
0
votes
4 answers
React Suspense Concurrent Mode Not Working
I am trying to use react suspense but I am facing some issue regarding rendering after making changes in react index.js file and I already installed react suspense "npm install react@experimental react-dom@experimental"
My index.js file
import React…

Ahsan Shakeel
- 11
- 2
- 4
0
votes
1 answer
How to return a promise from a Provider in react
I have a provider that does some work when it loads (one time). It adds a script tag for a map then when that script is loaded it initializes the map.
I want to the children to be able to use suspense. I'd like to return from that provider a…

Diesel
- 5,099
- 7
- 43
- 81
0
votes
1 answer
Component with React Suspense cause Eternal Loop
I am learning React, and trying to use Suspense.
On the First, I try to use wrapped promise object for props.
Wrapper throw promise when it not solved. It loop forever.
Then I try it with useEffect, but it has same problem.
Here is my code and…

MIsoku
- 25
- 5
0
votes
1 answer
How to load multiple components at same time in reactJs?
Here I am having 4 components, where I am rendering all these four components in App.js. These four components individually hitting different APIs. So one component may render faster and others may render slower. What I am trying to achieve here is…

SDK
- 1,356
- 3
- 19
- 44
0
votes
0 answers
React lazy load failing when rendering inside a permission based function
I have following code in my App.js file, the idea is to lazy load elements if they have the permissions to do so:
import React from 'react';
import { Suspense, lazy } from 'react';
import {
Router,
Switch,
Route
} from…

cwiggo
- 2,541
- 9
- 44
- 87
0
votes
0 answers
React-i18next init callback resolving before Suspense resolves
Using react-i18next with Suspense.
I want to use the init callback option to run an axios interceptor to ensure all requests add the correct header language.
My problem is that the init callback doesn't halt the Suspense to render its children. I…

Hoetmaaiers
- 3,413
- 2
- 19
- 29
0
votes
0 answers
Suspense loading icon on every update
I have the following React component:
const Bleh = (props: any) => {
const [val, setVal] = React.useState("")
return

meds
- 21,699
- 37
- 163
- 314
0
votes
1 answer
React suspense looks for the chunk in the wrong directory
I'm trying to build a basic react lazy app using the webpack. it creates the chunk successfully but when the app is running it looks for the chunk in the wrong directory, therefore, app crashes. My build directory is the dist, and I put my js files…

Jora
- 191
- 2
- 13
0
votes
0 answers
React Suspense/Concurrent - SuspenseList order not working
I was following along Ben Awad's video and tried to extend the idea to react SuspenseList but couldn't get the items to show in reverse order or together when I changed the revealOrder. In all the cases the endpoints are called one after another and…

Yasin Yaqoobi
- 1,888
- 3
- 27
- 38
0
votes
1 answer
Can't render route with switch statements React router dom 5.0.0
I'm fairly new to React Router.. I'm using React-router-dom 5.0.0
My dashboard route isn't matching for some reason and nothing is rendered when I navigate to /dashboard
import React, { Suspense } from 'react';
import ReactDOM from…

Sachit Shetty
- 113
- 1
- 1
- 9