Props in React

Props are objects passed to child component from parent component. Based on values of Props and state, React renders the component. In below example, we have passed color prop to Car component and then Car Component is accessing the prop value to render UI.


<Car color='red'/>

export default function Car = (props)=>{
    return (
        <>
        Car color is {props.color}
        </>
    }
}

Complex problems, Simple Solutions