Skip to content

如何 区分函数组件和类组件 ​

本节目标:理解“如何 区分函数组件和类组件”的核心思路,并能把它用于实际开发或面试表达。 export function Component(props) { this.props = props; } Component.prototype.isReactComponent = {};

/* class Component{ static isReactComponent=true; constructor(props){ this.props = props; } } */