Questions tagged [react-concurrent]

12 questions
20
votes
1 answer

Store a callback in useRef()

Here is an example of a mutable ref storing the current callback from the Overreacted blog: function useInterval(callback, delay) { const savedCallback = useRef(); // update ref before 2nd effect useEffect(() => { savedCallback.current =…
bela53
  • 3,040
  • 12
  • 27
2
votes
1 answer

How to update redux store with react suspense

In following code, Sample uses a async function to get some data. I will be using that data to update the Redux store so any component can access the username within the application. const resource = fetchData(); function Sample() { // throws a…
s1n7ax
  • 2,750
  • 6
  • 24
  • 53
1
vote
0 answers

How to detect react concurrent mode?

How to detect that the current used React (stable/release) version in an application supports concurrent mode ? Let's say you are authoring a library that should target several react versions, and only add concurrent features if they are…
Incepter
  • 2,711
  • 15
  • 33
1
vote
0 answers

Does useEffect not work with useTransition (Concurrent API)

If I understand (and appreciate) the purpose of useTransition correctly, it's to avoid the intermediate "loading" state, as expressed in the example from the docs: The "Loading profile..." text doesn't appear with useTransition But this doesn't…
laggingreflex
  • 32,948
  • 35
  • 141
  • 196
1
vote
1 answer

What causes the component to render again if it was already suspended in concurrent react mode?

I was checking the new concurrent mode in react docs and came across this example. Loading profile...}> Here the component gets suspended if the data we are trying to load is…
Rahil Ahmad
  • 3,056
  • 1
  • 16
  • 21
1
vote
1 answer

Getting React concurrent promise wrapper to inherit returned interface object

I am experimenting with concurrent mode and suspense in React and am getting a type error when I am trying to drill some mock data from a parent component to a child component because my promise wrapper does not inherently know about the type that…
Jimmy
  • 3,090
  • 12
  • 42
  • 99
0
votes
0 answers

Is there a performance / UX benefit of using react Suspense if no child suspends?

If I wrap a component in Suspense and its child does async work (or suspends for some other reason), then it gets rendered non-urgently when it's ready (based on this Interacting with the page before all the components have hydrated and this). This…
Kroney
  • 73
  • 5
0
votes
0 answers

Is it possible that an update is delayed for a very long time in React18 with concurrent rendering?

As I know, in React 18, a concurrent task can interrupted by an urgent update. So, is it possible that a concurrent task is delayed for a very long time or may never be executed because there is always an urgent update is executed? If not, then why?…
0
votes
0 answers

How to use the react concurrent mode

I have installed the "yarn add react@experimental react-dom@experimental",and use the unstable_createRoot,but have the error with start. this is my index.js: import React from 'react'; import ReactDOM from 'react-dom'; import App from…
0
votes
1 answer

Will derived state be allowed for React Concurrent Mode?

Today we can use getDerivedStateFromProps for class components and state updates during render phase for React Hooks/function components to create derived state, if needed. I am especially curious about the React Hook variant: Will this be allowed…
0
votes
1 answer

Show loading state but also show previous results in React Concurrent gives a warning

UPDATE: Ok, it I misunderstood useDeferredValue, I thought it was more like a debounced value but it's not, you can define the timeout to be the time the old results will be shown. So const search = useDeferredValue(value, { timeoutMs: 10000 }) Gave…
Richard Lindhout
  • 2,038
  • 2
  • 23
  • 38
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