What does “Stateless function components cannot be given refs” mean?

后端 未结 2 1342
春和景丽
春和景丽 2020-12-30 19:01

I have this:

const ProjectsSummaryLayout = ({projects}) => {
   return (
      

Pr

2条回答
  •  清酒与你
    2020-12-30 19:20

    React has 2 commonly used component styles.

    • Functional Component
    • Class Component

    So, When I was making use of Functional one then I was encountering this error.

    Code snippet corresponding to Functional Component

    But as soon as I changed it to Class Component then it worked.

    Code snippet corresponding to Class Component.

    Try changing Functional Component to Class Component. I hope it will resolve your problem.

提交回复
热议问题