Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- export class Greeting extends React.Component { //export component class for App class
- render() {
- return <h1>Hi there, {this.props.name}!</h1>; //then this line will appear with the Greeting instance in App class
- }
- }
- ====================================================================================
- import React from 'react';
- import ReactDOM from 'react-dom';
- import {Greeting} from './Greeting'; //import Greeting component class
- class App extends React.Component {
- render() {
- return (
- <div>
- <h1>
- Hullo and, "Welcome to The Newzz," "On Line!"
- </h1>
- <Greeting name="Orange"/> //add a Greeting instance with a name attribute
- <article>
- Latest newzz: where is my phone?
- </article>
- </div>
- );
- }
- }
- ReactDOM.render(
- <App />,
- document.getElementById('app')
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement