Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, August 14, 2018

Codecademy Sample Solution: Use a Variable Attribute in a Component


// sample solution for app.js

import React from 'react';
import ReactDOM from 'react-dom';


const owl = {
  title: 'Excellent Owl',
  src: 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-owl.jpg'
};

class Owl extends React.Component {
  render() {
    return (
      <div>
        <h1>{owl.title}</h1>
        <img
          src={owl.src}
          alt={owl.title} />
      </div>
    );
  }
}

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

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts