Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
NextJs Server Side props not getting the data to pass to component

I got stuck with this problem and don't know how to fix it. I set up the server side props and it's working on the terminal on vscode but when i inspect in chrome or try to do something with it well, nothing appears.

export const getServerSideProps = async (context) => {
    try {
    let properties = []
    const propertiesRef = collection(firestore, 'properties')
    const q = query(propertiesRef, orderBy("propertiename", "desc"))
    
        
        onSnapshot(q, (snapshot) => {
        properties.push(snapshot.docs.map((doc) => (
            { ...doc.data(), id: doc.id }
        )))
        console.log(properties)
    });
        
    return {
        props: {
            propertiesProps : properties,
        }
        }
    } catch(error) {
        console.log(error)
    }
}

When i pass the data here in the page i dont get anything back

    function index({propertiesProps}) {
    const [properties, setProperties] = useState([])

    useEffect(async () => {
        setProperties( propertiesProps)
        console.log(properties)
    }, [])



    return (
        <div>
            <Head>
                <title>Rimoz | Properties</title>
            </Head>
            <h1 className="main">Heres is the list of properties</h1>
            <PropertieGallery />
            <h1 className="main">Com server side props</h1>
            <p></p>
        </div>
    )
}

export default index

And this is what i get in the terminal on vscode

[
  [
    {
      propertiename: 'casa 57',
      photos: [Array],
      id: 'lKOfK8oirnLY5DNEJagH'
    },
    {
      propertiename: 'casa 56',
      photos: [Array],
      id: 'r1IRpreknf5Pd7FqRUqJ'
    },
    {
      photos: [Array],
      propertiename: 'casa 55',
      id: 'H2ADAlP4dyuZJCsYNnor'
    },
    {
      propertiename: 'casa 54',
      photos: [Array],
      id: 'dB8wHXjwFHGB3JoIIGQv'
    },
    {
      propertiename: 'casa 4 ',
      photos: [Array],
      id: 'jApsE2wgxBpdbajuObgx'
    },
    {
      propertiename: 'casa 3 ',
      photos: [Array],
      id: 'mrOJasIuHUXI5ojISSWD'
    },
    {
      photos: [Array],
      propertiename: 'casa 2',
      id: 'rBOG1mXUewKYiH47MbdM'
    },
    {
      photos: [Array],
      propertiename: 'casa 14',
      id: 'c3ozTup7m1ZWIjSSzh7v'
    }
  ]
]

What am i missing here?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!