Wooo! Your first React component!
Take a look at the code on line 1:
import React from 'react';
This line of code creates a new variable. That variable’s name is
This imported object contains methods that you need in order to use React. The object is called the React library.
Later, we’ll go over where the React library is imported from, and how the importing process works. For now, just know that you get the React library via
import React from 'react';.
You’ve already seen one of the methods contained in the React library:
React.createElement(). Recall that when a JSX element is compiled, it transforms into a
For this reason, you have to import the React library, and save it in a variable named
React, before you can use any JSX at all.
React.createElement() must be available in order for JSX to work.
On line 1, use
import to import the React library. Save the library in a variable named