English 中文(简体)
ReactJS - Properties (props)
  • 时间:2024-11-03

ReactJS - Properties (props)


Previous Page Next Page  

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