Introduction
Components
Now, have a look at this code block.
š I didn't include the ReactDOM.render code here to make things simple.
(I won't include that in the rest of the course too.)
(I won't include that in the rest of the course too.)
function Welcome() {
return (
<div>
<hr/>
<p>Welcome to React</p>
</div>
)
}
function Page() {
return (
<div>
<h1>Hello World</h1>
<Welcome />
</div>
)
}
Here we have another React component called Welcome. We can render it inside our "Page" component using this syntax: <Welcome /> Basically, you can render it like any other HTML element.
Now try to rename our component into welcome and render it again.
(Use this live React editor to try it out.)
Q: What has happened?
authenticating...
š We need your help
We need your help to keep maintain & add new content to this course. Here's how you can support us:
- š¬ Write a review
- š° Make a donation
- š Share this lesson