I have issue React.jsx: 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 issue has been tracked since 2022-09-12.

Plz help me to solve this

This is my feed.jsx file

import React,{useState,useEffect} from 'react';
import { useParams } from 'react-router-dom';

import { client } from '../client';
import { feedQuery, searchQuery } from '../utils/data';

import MasonryLayout from './MasonryLayout';
import Spinner from './Spinner';

const Feed = () => {
const [pins, setPins] = useState();
const [loading, setLoading] = useState(false);
const { categoryId } = useParams();

useEffect(() => {
if (categoryId) {
setLoading(true);
const query = searchQuery(categoryId);
client.fetch(query).then((data) => {
setPins(data);
setLoading(false);
});
} else {
setLoading(true);

  client.fetch(feedQuery).then((data) => {
    setPins(data);
    setLoading(false);
  });
}

}, [categoryId]);

if (loading) return

return (


Feed

)
}

export default Feed

This is MasonryLayout.jsx file

import React from 'react';
import Masonry from 'react-masonry-css';
import Pin from './Pin';

const breakpointObj = {
default: 4,
3000: 6,
2000: 5,
1200: 3,
1000: 2,
500: 1,
};

const MasonryLayout= ({ pins })=> (

{pins?.map((pin) => )}

);

export default MasonryLayout;

When i put simply "Feed" in return in feed.jsx file it is okay but when i put

** {pins &&

}**

It show empty page

![Screenshot from 2022-09-12 21-46-09](https://user-images.githubusercontent.com/100952840/189730151-32dddfb9-0ce8-483d-8630-e9f8b20d7b
Screenshot from 2022-09-12 21-47-06
03.png)

Screenshot from 2022-09-12 21-46-09

rickhanlonii wrote this answer on 2022-09-12

I think it's because MasonryLayout renders undefined when pins is undefined (which it is on the first render), but we don't typically handle support requests filed as GitHub issues. I suggest posting to StackOverflow if that doesn't help:

https://stackoverflow.com/questions/tagged/react

More Details About Repo
Owner Name facebook
Repo Name react
Full Name facebook/react
Language JavaScript
Created Date 2013-05-24
Updated Date 2022-10-03
Star Count 195549
Watcher Count 6650
Fork Count 40505
Issue Count 1119

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date