React Js / Basics / Props
Props
-
1. Step
Props are arguments passed into React components. 1. Pass Data
function Car(props) { return I am a { props.brand }!
; } function Garage() { return ( <>Who lives in my garage?
> ); } 2. send variable
function Car(props) { return I am a { props.brand }!
; } function Garage() { const carName = "Ford"; return ( <>Who lives in my garage?
> ); } 3. send object
function Car(props) { return I am a { props.brand.model }!
; } function Garage() { const carInfo = { name: "Ford", model: "Mustang" }; return ( <>Who lives in my garage?
> ); }
MANVIA BLOG