I'm using ColorThief library in react. Here's my code:
import Color from 'color-thief-react';
mappedPopularBooks = Object.keys(popularBooks).map(key => {
var book = popularBooks[key];
return <Color src={book.image}>
{({data, loading, error}) => (
<div style={{
backgroundColor: data,
backgroundSize: "91px 141px",
backgroundPosition: "center center",
backgroundRepeat: "no-repeat",
backgroundImage: "url('" + book.image + "')"
}} className="Home-item" key={`popular-${key}`}>
{data}
</div>
)}
</Color>
});
The backgroundColor is not being set. What should I do?