React: checker is not a function

前端 未结 12 1406
庸人自扰
庸人自扰 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:47

    Reactv16

    In my version of this error I had an array of objects:

    data: PropTypes.shape([{
      id: PropTypes.number,
      ...
    }])
    

    The solution was to make an array of shapes like so:

    data: PropTypes.arrayOf(
      PropTypes.shape({
        id: PropTypes.number,
        ...
      })
    )
    

提交回复
热议问题