DEV Community

Cover image for Passing Components as Props in React
Mohamed Amine Fh
Mohamed Amine Fh

Posted on

Passing Components as Props in React

Programming is a lifelong learning journey, and most of that journey is asking Questions.

And one of the Q i've asked while learning React is How To pass a component as Props?.

In this short Tutorial we will pass a simple React component (Hello) to The App component as props

Hello world Component

Pass it as a Prop

App


And This is How we use it in App Component.

Components Must Start with an upper case letter.
That's why we rename it Here

use component as a prop

That's it Easy Peasy Lemon Squeezy 😎

So this is a Simple Exp though, but when it comes to large Apps, you will definitely need to use this.

Hope you like this Tuto

Top comments (0)