Since your function is returning an object return {'--bg-color': props.bgm}
, it seems that this exact object is being passed as a backgroundImage
value. Background-image property cannot consume this value.
Try to return correct css background-image value of type string as per MDN documentation