原因:element ...">
美文网首页
Functions are not valid as a Rea

Functions are not valid as a Rea

作者: Rose_yang | 来源:发表于2022-09-22 16:52 被阅读0次
    Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
    

    如下源码导致报错
    <Route path="/demo" element={Demo} />

    原因:element 的值是组件 注意格式

    修复如下:
    <Route path="/demo" element={<Demo />} />

    相关文章

      网友评论

          本文标题:Functions are not valid as a Rea

          本文链接:https://www.haomeiwen.com/subject/qvnwortx.html