Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Component is not rendering in react js

Why this component is not rendering in react js.It shows the error message Unhandled Runtime Error Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

This is my component

function Test({session}) {
    const RenderPage=fetchComment &&(
                fetchComment?.map((comment)=>{
                    return <LoadComment
                    key={i}
                    timestamp={comment.timestamp?.toDate()}
                    comment={comment.comment}
                    image={comment.image}
                    user={comment.user} />
                })
                )
return (
<RenderPage></RenderPage>
)
}
like image 249
Jeevan Avatar asked Aug 13 '26 00:08

Jeevan


1 Answers

return (
{RenderPage}
)

change the return statement. since its a variable not a component.

like image 56
Daniel Paul Avatar answered Aug 14 '26 13:08

Daniel Paul