6. Share Styles Across Multiple Components

<PLEASE HELP! I DON’T KNOW WHERE IS MY WRONG IN CODE>
please help! I don’t know where is my wrong in code

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/react-102/lessons/style/exercises/styles-multiple-components

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
this the error message I got
Oops! The test returned an error. Maybe you have a syntax error, or a typo. See full error.



import React from 'react';
import ReactDOM from 'react-dom';
import { AttentionGrabber } from './AttentionGrabber';
import {styles} from './styles';
export class Home extends React.Component {
  const divStyle = {
    background: styles.background,
    height: '100%'
  }
  render() {
    return (
      <div style={divStyle}>
        <AttentionGrabber />
        <footer>THANK YOU FOR VISITING MY HOMEPAGE!</footer>
      </div>
    );
  }
}

ReactDOM.render(
	<Home />, 
	document.getElementById('app')
); 


looking at step 5 of the instructions:

Select Home.js. In between the styles import and the Home component declaration, define a new variable const divStyle

you placed divStyle at the wrong place, it shouldn’t be part of Home component.

1 Like

Still, give me the same error!

It’s work I was just written another wrong code in “AttentionGrabber” file
thank you.