DEV Community

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

Posted on

1

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

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs