“In React, everything is a component.” Explain.

Forums React“In React, everything is a component.” Explain.
Staff asked 2 years ago

Answers (1)

Add Answer
Staff answered 2 years ago

In React, anything is a component, in fact! Even basic HTML tags are components since they are included by default and built-in.

Let’s look at an illustration:

import React from 'react'
import ReactDOM from 'react-dom'


ReactDOM.render(<h1>I'm a component!</h1>, 
document.getElementById('myapp'))

 

Subscribe

Select Categories