A React class component crashes with render is not a function
Fix it fast
Most common cause, 1 of 2The class has no render method, or it is spelled differently
Add a render method that returns the JSX, spelled exactly render.
class Profile extends Component {
render() {
return <h1>{this.props.name}</h1>;
}
}
// or, as React recommends for new code
function Profile({ name }) {
return <h1>{name}</h1>;
}Short answer
TypeError: instance.render is not a function means React 19 built a class component instance and found no render method on it. Either render is missing or misspelled, or the constructor returned another object. The development console warning No render method found names the component and which case it is. Add render() or convert the class to a function component.
Which cause do you have?
Run the app in development mode and read the console warning that comes before the TypeError. It names the component, and its second half tells you which of the two causes below you have.
npm run devThen find the line you see in this list and open its fix:
What does the error look like?
TypeError: instance.render is not a functionNo `render` method found on the Profile instance: you may have forgotten to define `render`.No `render` method found on the Profile instance: did you accidentally return an object from the constructor?
Cause 1 of 2
The class has no render method, or it is spelled differently
You seeThe warning ends with you may have forgotten to define `render`.
Check
instance.render is not a function with the forgotten-render warning means the class itself has no method called render. React prints this text when neither the instance nor the class prototype has a function called render. The React docs call render the one method a class component must have, so a class that only defines Render, renderContent or a lifecycle method fails here.
grep -n -E "extends (React\.)?(Pure)?Component|render[[:space:]]*\(" src/components/Profile.jsxFix
Add a render method that returns the JSX, spelled exactly render. For new code React recommends a function component, which has no render method at all.
class Profile extends Component {
render() {
return <h1>{this.props.name}</h1>;
}
}
// or, as React recommends for new code
function Profile({ name }) {
return <h1>{name}</h1>;
}Verify
Reload the page. The warning and the TypeError are both gone, and the component draws.
npm run devConfirmed by raw.githubusercontent.com
Cause 2 of 2
The constructor returns an object
You seeThe warning ends with did you accidentally return an object from the constructor?
Check
instance.render is not a function with the constructor warning means the constructor handed back an object in place of the instance. React shows this second wording when the class prototype does have render but the instance it got back does not. MDN notes that a derived class constructor may return an object; React's wording points at exactly that case, where the returned object stands in for the instance and carries no render.
grep -n -A12 "constructor(props)" src/components/Profile.jsxFix
Remove the return from the constructor. The docs limit a constructor to calling super(props), setting this.state and binding methods.
constructor(props) {
super(props);
this.state = { open: false };
// no return statement here
}Verify
After a reload the console stays quiet, and toggling the open flag still updates the screen.
npm run devConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Write new components as functions, as the React docs recommend; only class components can hit this error.
- Keep constructors to super(props), this.state and method binding, with no return.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, QistLock, Taskvare.