Things you didn’t know about react props

We all know , in react , props are used to send data from parent component to child component as an attribute. Today we will learn about advanced props.

Default Prop Value

You can define default prop value like javascript’s default argument , using defaultProps property.

MyComponent.defaultProps = {
firstName:'John',
lastName: 'Doe',
age: 42,
};

--

--