6. Share Styles Across Multiple Components


#1


please help! I don't know where is my wrong in code


https://www.codecademy.com/en/courses/react-102/lessons/style/exercises/styles-multiple-components


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')
);


#2

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.


#3

Still, give me the same error!


#4

It's work I was just written another wrong code in "AttentionGrabber" file
thank you.


#5