I'm currently following a tutorial on creating an RPG game using React. The tutorial can be found at this link. I am trying to replicate the presenter's code by typing it out myself.
However, I'm running into an issue when attempting to add a background image to a div. I keep getting an Unexpected token error specifically at 'backgroundImage' in the code snippet below:
class Player extends React.Component {
render() {
return (
<div
style={{
position:'absolute',
top: props.position[1],
left: props.position[0],
backgroundImage: 'url('${Unicorn})',
backgroundPosition: '0 0',
width:'32px',
height:'32px'
}}
/>
)
}
mapStateToProps=(state)=>{
return{
...state.Player,
}
}
}