checkClassInstance() — react Function Reference
Architecture documentation for the checkClassInstance() function in ReactFizzClassComponent.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 21ed4638_6bbb_68b6_932b_c6d5a9608876["checkClassInstance()"] 8f850c79_0562_f37f_80ff_563c50cd0996["ReactFizzClassComponent.js"] 21ed4638_6bbb_68b6_932b_c6d5a9608876 -->|defined in| 8f850c79_0562_f37f_80ff_563c50cd0996 214e29b1_8411_c0df_65fc_dabe157ff86e["mountClassInstance()"] 214e29b1_8411_c0df_65fc_dabe157ff86e -->|calls| 21ed4638_6bbb_68b6_932b_c6d5a9608876 style 21ed4638_6bbb_68b6_932b_c6d5a9608876 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-server/src/ReactFizzClassComponent.js lines 313–542
function checkClassInstance(instance: any, ctor: any, newProps: any) {
if (__DEV__) {
const name = getComponentNameFromType(ctor) || 'Component';
const renderPresent = instance.render;
if (!renderPresent) {
if (ctor.prototype && typeof ctor.prototype.render === 'function') {
console.error(
'No `render` method found on the %s ' +
'instance: did you accidentally return an object from the constructor?',
name,
);
} else {
console.error(
'No `render` method found on the %s ' +
'instance: you may have forgotten to define `render`.',
name,
);
}
}
if (
instance.getInitialState &&
!instance.getInitialState.isReactClassApproved &&
!instance.state
) {
console.error(
'getInitialState was defined on %s, a plain JavaScript class. ' +
'This is only supported for classes created using React.createClass. ' +
'Did you mean to define a state property instead?',
name,
);
}
if (
instance.getDefaultProps &&
!instance.getDefaultProps.isReactClassApproved
) {
console.error(
'getDefaultProps was defined on %s, a plain JavaScript class. ' +
'This is only supported for classes created using React.createClass. ' +
'Use a static property to define defaultProps instead.',
name,
);
}
if (instance.contextType) {
console.error(
'contextType was defined as an instance property on %s. Use a static ' +
'property to define contextType instead.',
name,
);
}
if (disableLegacyContext) {
if (ctor.childContextTypes && !didWarnAboutChildContextTypes.has(ctor)) {
didWarnAboutChildContextTypes.add(ctor);
console.error(
'%s uses the legacy childContextTypes API which was removed in React 19. ' +
'Use React.createContext() instead. (https://react.dev/link/legacy-context)',
name,
);
}
if (ctor.contextTypes && !didWarnAboutContextTypes.has(ctor)) {
didWarnAboutContextTypes.add(ctor);
console.error(
'%s uses the legacy contextTypes API which was removed in React 19. ' +
'Use React.createContext() with static contextType instead. ' +
'(https://react.dev/link/legacy-context)',
name,
);
}
} else {
if (instance.contextTypes) {
console.error(
'contextTypes was defined as an instance property on %s. Use a static ' +
'property to define contextTypes instead. (https://react.dev/link/legacy-context)',
name,
);
}
if (
ctor.contextType &&
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does checkClassInstance() do?
checkClassInstance() is a function in the react codebase, defined in packages/react-server/src/ReactFizzClassComponent.js.
Where is checkClassInstance() defined?
checkClassInstance() is defined in packages/react-server/src/ReactFizzClassComponent.js at line 313.
What calls checkClassInstance()?
checkClassInstance() is called by 1 function(s): mountClassInstance.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free