React: checker is not a function

前端 未结 12 1439
庸人自扰
庸人自扰 2021-02-04 23:25

I\'m getting this weird warning message in the console for my React app.

Warning: Failed propType: checker is not a function Check the render method of <

12条回答
  •  广开言路
    2021-02-04 23:33

    In my case I got this when I used the shape function with a complex object. The solution was to go from:

    outerObject: shape({
      firstInnerObject: {
        a: string,
        b: string,
      },
      secondInnerObject: {
        a: string,
        b: number,
      },
    }),
    

    To:

    outerObject: shape({
      firstInnerObejct: shape({
        a: string,
        b: string,
      }),
      secondInnerObject: shape({
        a: string,
        b: number,
      }),
    }),
    

    Very trivial, I know, yet this might be the solution for someone equally inexperienced as I am. ;)

提交回复
热议问题