Challenge: Create Functional Components
Create a functional React component that displays a greeting message using props.
The task consists of two parts:
- Create a child component
- Create a component called
Greeting. - Accept a prop called
name. - Render an
h2element with the text:Hello, {name}.
- Create a component called
- Create a parent component
- Create a component called
App. - Render the
Greetingcomponent inside it. - Pass the value
"Oliver"to thenameprop.
- Create a component called
- Render the
Appcomponent- Render the
Appcomponent usingroot.render.
- Render the
- The child component receives data using props.
- Use
{props.name}inside JSX. - Pass the
nameprop when renderingGreeting. - The
Appcomponent should be rendered to the DOM.
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 2
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4
Challenge: Create Functional Components
Swipe to show menu
Create a functional React component that displays a greeting message using props.
The task consists of two parts:
- Create a child component
- Create a component called
Greeting. - Accept a prop called
name. - Render an
h2element with the text:Hello, {name}.
- Create a component called
- Create a parent component
- Create a component called
App. - Render the
Greetingcomponent inside it. - Pass the value
"Oliver"to thenameprop.
- Create a component called
- Render the
Appcomponent- Render the
Appcomponent usingroot.render.
- Render the
- The child component receives data using props.
- Use
{props.name}inside JSX. - Pass the
nameprop when renderingGreeting. - The
Appcomponent should be rendered to the DOM.
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 2