React JS - props in Functional Component

Create a new functional component, for example, Props1.js

Open App.js and pass data to Props1 component :


In the above,we are passed name from App component to Props1 component.

Now, open Props1.js and access the name data :


Example 2 : Passing multiple data as object

Create a new functional component, for example, Props2.js

Open App.js and pass data to Props2 component :


In the above,we are passed name & others (object) from App component to Props2 component.


Now, open Props2.js and access the data :




Comments