ReactJS - Properties (props)


Advertisements

React enables developers to create dynamic and advanced component using properties. Every component can have attributes similar to HTML attributes and each attribute’s value can be accessed inside the component using properties (props).

For example, Hello component with a name attribute can be accessed inside the component through this.props.name variable.

<Hello name="React" />
// value of name will be "Hello* const name = this.props.name

React properties supports attribute’s value of different types. They are as follows,

  • String
  • Number
  • Datetime
  • Array
  • List
  • Objects

Let us learn one by one in this chapter.

Advertisements