Can someone assist me with setting a background for a div using react js, where I pass the background URL as a parameter?
This is the main functionality.
function Main (){
return (
<main className="Main">
<List BGimage={"./20180820_192057.jpg"}/>
</main>
)
}
// I am looking to pass BGimage as a parameter to set my background image
import React, { Component } from 'react';
export class List extends Component{
render()
return (
<div>
<div>
<div ClassName="BackGround" style={{backgroundImage: this.props.BGimage}}>
</div>
</div>
</div>
)
}
}
export default List