-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Step 1: Import React. This lets you use JSX inside your .js file. | ||
import * as React from 'react' | ||
|
||
const ValidComponent = () => { | ||
return ( | ||
<div> | ||
<h1>A valid component!</h1> | ||
<p>This will work fine.</p> | ||
<p> | ||
Since there is only one top-level element: the div. | ||
</p> | ||
</div> | ||
) | ||
} | ||
|
||
const InvalidComponent = () => { | ||
return ( | ||
<div> | ||
<h1>This won't work.</h1> | ||
<p>Because there are two elements at the top level.</p> | ||
</div> | ||
) | ||
} | ||
/* Step 2: Define your component. Note that your | ||
component name should start with a capital letter. */ | ||
const MyComponent = () => { | ||
return ( | ||
<h1>Hi, welcome to my site!</h1> | ||
) | ||
} | ||
|
||
/* Step 3: Export your component so it | ||
can be used by other parts of your app. */ | ||
export default MyComponent |