React styles const not working

const styles = {
   border="2px solid purple",
// change code above this line
class Colorful extends React.Component {

  render() {
    // change code below this line
    return (
      <div style ={styles} >Style Me!</div>
    // change code above this line

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


The last line of your object, you see the problem? You need a colon, not an equals sign. I make that same mistake at least once a day.

Also, the instructions say a font-size of 40, not “40px”. And realize that it is a number, not a string.

thanks for help bro,yeah its colon my mistake but "40px"is fine ig by default its px only but if we need to apply em then we need to do “40em” so “40px” is fine ig if we want to be explict

I could not get the test to pass until I changed that to the number 40. It may be allowed in React inline styles, but it wasn’t allowed on the test.