Add properties to the component

Previous tutorial we studied how to create React component. Now we will see how to add properties to the component

You can add dicount property to the Products component as shown in the below code and I have passed the value of discount as 10

Now lets see how we can display the property value in product.js file

To display the value of property we added you can use the {this.props.discount}

Leave a Reply

Your email address will not be published. Required fields are marked *