Home > other >  NextJS Image url not changing in different endpoints
NextJS Image url not changing in different endpoints

Time:05-30

So currently I have an issue where I have a Channel Tab where it displays the channel icon and name. Now the problem is, every time I change channels the icon stays the same as the first channel I clicked.

PREVIEW

Preview

This is my current code: https://sourceb.in/IsTYrBRjMv

How do I make it change every time I enter a new channel?

Note: Every channel has a different endpoint

CodePudding user response:

Try adding a useEffect, something like this (you may need to adjust)

  useEffect(() => {
    setData(channel.icon);
  },[channel]);
  • Related