1. The tag of the function component when creating fiber is specified as indeterminate
The instance creation process will determine if fiber and updates are created as a function component or as a class component based on the result returned by this function
typeof value === 'object'&& value ! = =null &&
typeof value.render === 'function' &&/ /! The Render method will call this class component
value.$$typeof === undefined
Copy the code
A return value that meets this condition is considered a class component
If not, it will be considered a functional component
import React from 'react'
export default function TestIndeterminateComponent() {
return {
componentDidMount() {
console.log('invoker')},render() {
return <span>aaa</span>}}},Copy the code
If the return value is an object and the Render method is created according to the class component, the object life cycle of the return will be executed