Whats the point of the Home.js file and home class?


#1

Hi there,

This file Home.js with the class Home is not being used anywhere in the output render. Whats it for?

import React from 'react';
import ReactDOM from 'react-dom';
import { Welcome } from './Welcome';

class Home extends React.Component {
  render() {
    return <Welcome name='Ludwig van Beethoven' />;
  }
}

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

Would much appreciate any clarity on this …

Thank you.


#2

Can you share the url of the exercise?

uhm… home is being rendered:


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

#3

Thanks for the reply…

The url is
https://www.codecademy.com/courses/react-101/lessons/this-props/exercises/render-ui-based-props?action=resume_content_item&link_content_target=interstitial_undefined

Yes Home is being rendered to ‘app’ but so is App in the final exercise, and changing the name to Wolfgang Amedeus Mozart has no effect because (as I understand it) Home is not being exported or called in the other components in anyway.

So i guess what i really want to understand is that is there anyways these compenents exchange conditional data( or are supposed to) with each other than through ‘export’ and ‘import’? … For instance by a

ReactDOM.render("**Component**",document.getElementById('**to same app**')

call in two discrete files?

Apologies if this is a bonafide silly question :slight_smile:


#4

the confusing thing here is that the exercise provides two files (Home and Welcome) with examples, and 2 files (Greeting and App) you actually need to work on. In essence, you have two apps here.

and it seems the example files do not render, although normally they would. Home would normally render fine.

this is not really common, but the exercise felt the need to provide an example it seems.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.