Exercise

In this exercise, you have to create and render the Title component of the app.

Create the component

Create a new file named Title.js and create a simple component that is just a function that returns a React element.

import React from 'react';

function Title() {
  return (
    <h1>😺 Emoji picker 🐶</h1>
  );
}

Note that you have to import React as <h1> will be transformed into React.createElement('h1')

Render your Title component

In your App.js, you can use your Title component by importing it and simply adding the JSX call in your render function:

import Title from './Title';
render() {
  return {
    <Title />
  }
}

See solution

Last updated