Reputation: 1839
I am trying to render a with its own background-color. The is rendering, but the background-color is not being changed
import React from 'react'
class Color extends React.Component {
constructor(props) {
super(props);
}
mkColor = () => {
return <div style="background-color: blue;">TEST!!!!</div>
}
render() {
return this.mkColor()
}
}
export default Color
How am I screwing this up?
Upvotes: 0
Views: 114
Reputation: 13702
You should use objects for style.
mkColor = () => {
return <div style={{backgroundColor: 'blue'}}>TEST!!!!</div>
}
Upvotes: 2