What is the proper React way to display loading info when performing heavy calculation?
I am performing a heavy computation in React, and I (1) don’t want the UI to block, and (2) want to display information about the process. I though that the useEffect
hook was the right way to approach this, but I’m not getting the right result.
useState creates infinit loop
Why does assigning the ‘setTimeSlotsList(fetchAPI(day))’ creates inifit loop?
How can I reuse a custom hook?
I am building a roster management application. I have built a roster viewer which uses the useRosterViewer hook
.
How can I use a custom hook in other custom hook?
I am building a roster management application.
I have built a roster viewer.
The useState set method is not reflecting a change immediately
I am trying to learn hooks and the useState
method has made me confused. I am assigning an initial value to a state in the form of an array. The set method in useState
is not working for me, both with and without the spread syntax.
Trying to pass ID between 2 Components
I’m trying to pass and ID from 1 component to another. The first set of code is creating a div to display the album with parameters passed into is. this is where I’m picking up the ID from and passing it to my SongId function in PlayerContext.
React 18 What happens under the hood when mutate the state directly and also call the setState function afterwards
I’ve came across to a case, which is simply mutating the state directly and then call the setState on an Input component.
Is it valid to place a hook inside and call it from within there?
VSCode doesn’t mark this as invalid, despite the hooks being conditionally run:
If I perform a cleanup activity after a delay would that affect my working?
Inspired by this post, if we remove the Event Listener in cleanup after a delay does the previous reference of the Event Handler still gets attached to the browser?
ReactJS state dependends on another state
I have component which contains range date picker and interval components, interval depends on the range date,
generateDefaultDateIntervalLimitations() function assings available interval options for interval, and rest is disabled according to date range, my problem is when date changes useEffect sets dateTimeInterval, because date changed it also changes interval state, and when interval state changed it again sets dateTimeInterval, that is normal, but my request depends on setDateTimeInterval which is defined in parent component as soon as this changes it rerenders parent component which has child components with react query and axios request, that make send request twice because of state changed first date and then interval, interval itself can be changed as well but only available once