Relative Content

Tag Archive for javascriptreactjsreact-hooks

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.

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