Getting “Cannot call a class as a function” in my React Project

后端 未结 30 938
無奈伤痛
無奈伤痛 2020-12-07 16:34

I\'m trying to add a React map component to my project but run into an error. I\'m using Fullstack React\'s blog post as a reference. I tracked down where the error gets thr

30条回答
  •  無奈伤痛
    2020-12-07 16:54

    This occured when I accidentally named my render function incorrectly:

    import React from 'react';
    
    export class MyComponent extends React.Component {
      noCalledRender() {
        return (
          
    Hello, world!
    ); } }

    My instance of this error was simply caused because my class did not have a proper render method.

提交回复
热议问题