U
U
unfapable2018-06-05 08:22:49
React
unfapable, 2018-06-05 08:22:49

What is a class component in React?

More precisely, I understand that such an entry is called class component (class component), but why not component class (component class)? After all, the second option would be more correct, or tell me how to translate into Russian - the component class? Otherwise, how to understand then the class component, what does it mean?

class App extends React.Component {
  constructor(props) {
 super(props)
 this.state = { username: 'johndoe' }
  }
  render() {
 const { username } = this.state
 return(
 <div>
 { username }
 </div>
 )
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly Zharov, 2018-06-05
@unfapable

In this case, class is the type of the component. It is more correct to translate not "class component", but "class component", as opposed to functional

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question