'Tailwind background image from api

I am trying to solve this one but have no luck. I am getting image-urls from API, and I want to put it as BG using tailwind but it doesn't work for me.

 <div
    className={`w-full h-60 rounded-2xl bg-cover bg-center bg-[url('${item.image}')]`}
  />


Solution 1:[1]

instead of using tailwind use style prop:

<div style={{ backgroundImage : ‘url(“${item.image}”)‘ }}></div>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paiman Rasoli