标签:fun subclass com cto port div UNC can component
super(props): Superclass will help you to keep the props:[^ props]
import React, { Component } from "react";
export default class App extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div>App</div>
);
}
}
But we use super() also can run
import React, { Component } from "react";
export default class App extends Component {
constructor() {
super();
}
render() {
return (
<div>
App
</div>
);
}
}
Subclass will auto execute the constructor function, we can not write it
import React, { Component } from "react";
export default class App extends Component {
render() {
return (
<div>App</div>
);
}
}
标签:fun subclass com cto port div UNC can component
原文地址:https://www.cnblogs.com/smallstars/p/14043521.html