Edit on GitHub

Special Non-DOM Attributes

Beside DOM differences, React offers some attributes that simply don't exist in DOM.

  • key: an optional, unique identifier. When your component shuffles around during render passes, it might be destroyed and recreated due to the diff algorithm. Assigning it a key that persists makes sure the component stays. See more here.
  • ref: see here.
  • dangerouslySetInnerHTML: Provides the ability to insert raw HTML, mainly for cooperating with DOM string manipulation libraries. See more here.