Alperen ARICI
Alperen ARICI

Reputation: 213

How to change backgroundImage dynamically?

I have a data on my hits array and I want to foreach them.

<Paper style={{backgroundImage:'url(${hit.profile_banner_url})'}}  className={classes.paper}>

It's not working. How Can I change backgroundImage on each loop.

Upvotes: 4

Views: 76

Answers (1)

Sina Farhadi
Sina Farhadi

Reputation: 785

you have to use `` instead of '
like below

<Paper style={{backgroundImage:`url(${hit.profile_banner_url})`}}  className={classes.paper}>

Upvotes: 3

Related Questions