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

114
Views
Props undefined when passed to component

Trying to pass dummy data to a component, props get passed as undefined and even console.log() inside the same page does not work? could someone please tell whats wrong here

import AllPosts from "../../components/posts/all-posts"

var DUMMY_POST = [
    {
        title: 'ter',
        slug:'getting-starterd',
        image:'getting-started-nextjs.png',
        excerpt: 'nkjadnknsdk,nsdikns',
        date: '2022-06-12'
    },
    {
        title: 'ter',
        slug:'getting-starterd-by',
        image:'nextjs-file-based-routing.png',
        excerpt: 'nkjadnknsdk,nsdikns',
        date: '2022-06-12'
    }
]
function AllPostsPage() {
    console.log(DUMMY_POST)
    return <AllPosts posts={DUMMY_POST}/>
}
export default AllPostsPage

_app.js file

import '../styles/globals.css'
import Layout from '../components/layout/layout'

function MyApp({ Component, pageProps }) {
  return (
    <Layout>
    <Component {...pageProps} />
    </Layout>
  )
}

export default MyApp

all-posts file

import classes from './all-posts.module.css'
import PostsGrid from './posts-grid'

function AllPosts(props) {
    // console.log(props)
    return (
    <section className={classes.posts}>
        <h1>All posts</h1>
        <PostsGrid posts={props.posts} />
    </section>
    )
}
export default AllPosts()

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I would declare DUMMY_POST inside the AllPostPage function first and give it a try.

about 4 years ago · Juan Pablo Isaza Report

0

import classes from './all-posts.module.css'
import PostsGrid from './posts-grid'

function AllPosts(props) {
    // console.log(props)
    return (
    <section className={classes.posts}>
        <h1>All posts</h1>
        <PostsGrid posts={props.posts} />
    </section>
    )
}
export default AllPosts;
about 4 years ago · Juan Pablo Isaza Report
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!