So I found a workaround. I realised that the GIF url context variable was not being updated.
So in the context hook I extracted the array of urls from the backend and I added that in as another context variable.
Then I used a currentIndex variable that is I used in the context to move to the next question to access the elements in my urls array.
That way I just extracted the urls and put them in an array and then passed that through context and looped through the array to extract the relevant gif url