Next Js TypeError: Cannot read property 'xxx' of undefined2019 Community Moderator ElectionDetecting an undefined object propertyGoogle MAP API Uncaught TypeError: Cannot read property 'offsetWidth' of nullUncaught TypeError: Cannot read property 'msie' of undefinedUncaught TypeError: Cannot read property 'msie' of undefined - jQuery toolsUncaught TypeError: Cannot read property 'top' of undefinedTypeError: Cannot read property 'then' of undefinedReact - uncaught TypeError: Cannot read property 'setState' of undefinedUncaught TypeError: Cannot read property 'play' of undefinedTypeError: Cannot read property 'xxx' of undefined jQueryNext.js no data from Post:id

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

Meme-controlled people

Planetary tidal locking causing asymetrical water distribution

This word with a lot of past tenses

Is a party consisting of only a bard, a cleric, and a warlock functional long-term?

Is it insecure to send a password in a `curl` command?

What is a ^ b and (a & b) << 1?

Happy pi day, everyone!

How to terminate ping <dest> &

Can I use USB data pins as power source

What are substitutions for coconut in curry?

Custom alignment for GeoMarkers

Bach's Toccata and Fugue in D minor breaks the "no parallel octaves" rule?

Why does energy conservation give me the wrong answer in this inelastic collision problem?

New passport but visa is in old (lost) passport

Recruiter wants very extensive technical details about all of my previous work

A single argument pattern definition applies to multiple-argument patterns?

Counting models satisfying a boolean formula

If I am holding an item before I cast Blink, will it move with me through the Ethereal Plane?

Why does a Star of David appear at a rally with Francisco Franco?

Are all passive ability checks floors for active ability checks?

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

I got the following comment from a reputed math journal. What does it mean?

Describing a chess game in a novel



Next Js TypeError: Cannot read property 'xxx' of undefined



2019 Community Moderator ElectionDetecting an undefined object propertyGoogle MAP API Uncaught TypeError: Cannot read property 'offsetWidth' of nullUncaught TypeError: Cannot read property 'msie' of undefinedUncaught TypeError: Cannot read property 'msie' of undefined - jQuery toolsUncaught TypeError: Cannot read property 'top' of undefinedTypeError: Cannot read property 'then' of undefinedReact - uncaught TypeError: Cannot read property 'setState' of undefinedUncaught TypeError: Cannot read property 'play' of undefinedTypeError: Cannot read property 'xxx' of undefined jQueryNext.js no data from Post:id










1















I get the below error when I run "next export". My build is fine but the export fails. I have been following a lot of tutorials but couldn't find a solution. Have I defined my someEntryAsProp correctly?



import Layout from '../components/myLayout.js'
import Link from 'next/link'
import createClient from '../helpers/getcontent';
import type from 'os';


function getPosts()
return [
id:'hello-nextjs' , title:'Hello Next.js' ,
id:'learn-nextjs' , title:'Learn Next.js is awesome' ,
id:'deploy-nextjs' , title:'Deploy apps with Zeit' ,
]

const PostLink = ( post ) => (
<li>
<Link as=`/p/$post.id` href=`/post?title=$post.title`>
<a>post.title</a>
</Link>
</li>
)

const Index = () => (

<Layout>
<h1>My Blog</h1>
<p>someEntryAsProp.fields.title</p>
<ul>
getPosts().map((post) => (
<PostLink key=post.id post=post/>
))
</ul>
</Layout>
);

Index.getInitialProps = async () =>

console.log('> Starting import',);
const client = createClient();
const entries = await client.getEntries(
// some query
content_type:type,
include:2
)

console.log(entries.items[0])
console.log('> Content gotten and written for',)

return someEntryAsProp: entries.items[0] ;
//return ;
;

export default Index


Error:




TypeError: Cannot read property 'someEntryAsProp' of undefined




Can anyone please help me where I am doing wrong?










share|improve this question
























  • Wouldn't you still have to use this.props.someEntryAsProp ?

    – Strebler
    Mar 6 at 20:57











  • I tried using that, but no luck. Adding . <p>this.props.someEntryAsProp.fields.title</p> gives another error *TypeError: Cannot read property 'props' of undefined *

    – Mateenah M
    Mar 7 at 8:24
















1















I get the below error when I run "next export". My build is fine but the export fails. I have been following a lot of tutorials but couldn't find a solution. Have I defined my someEntryAsProp correctly?



import Layout from '../components/myLayout.js'
import Link from 'next/link'
import createClient from '../helpers/getcontent';
import type from 'os';


function getPosts()
return [
id:'hello-nextjs' , title:'Hello Next.js' ,
id:'learn-nextjs' , title:'Learn Next.js is awesome' ,
id:'deploy-nextjs' , title:'Deploy apps with Zeit' ,
]

const PostLink = ( post ) => (
<li>
<Link as=`/p/$post.id` href=`/post?title=$post.title`>
<a>post.title</a>
</Link>
</li>
)

const Index = () => (

<Layout>
<h1>My Blog</h1>
<p>someEntryAsProp.fields.title</p>
<ul>
getPosts().map((post) => (
<PostLink key=post.id post=post/>
))
</ul>
</Layout>
);

Index.getInitialProps = async () =>

console.log('> Starting import',);
const client = createClient();
const entries = await client.getEntries(
// some query
content_type:type,
include:2
)

console.log(entries.items[0])
console.log('> Content gotten and written for',)

return someEntryAsProp: entries.items[0] ;
//return ;
;

export default Index


Error:




TypeError: Cannot read property 'someEntryAsProp' of undefined




Can anyone please help me where I am doing wrong?










share|improve this question
























  • Wouldn't you still have to use this.props.someEntryAsProp ?

    – Strebler
    Mar 6 at 20:57











  • I tried using that, but no luck. Adding . <p>this.props.someEntryAsProp.fields.title</p> gives another error *TypeError: Cannot read property 'props' of undefined *

    – Mateenah M
    Mar 7 at 8:24














1












1








1








I get the below error when I run "next export". My build is fine but the export fails. I have been following a lot of tutorials but couldn't find a solution. Have I defined my someEntryAsProp correctly?



import Layout from '../components/myLayout.js'
import Link from 'next/link'
import createClient from '../helpers/getcontent';
import type from 'os';


function getPosts()
return [
id:'hello-nextjs' , title:'Hello Next.js' ,
id:'learn-nextjs' , title:'Learn Next.js is awesome' ,
id:'deploy-nextjs' , title:'Deploy apps with Zeit' ,
]

const PostLink = ( post ) => (
<li>
<Link as=`/p/$post.id` href=`/post?title=$post.title`>
<a>post.title</a>
</Link>
</li>
)

const Index = () => (

<Layout>
<h1>My Blog</h1>
<p>someEntryAsProp.fields.title</p>
<ul>
getPosts().map((post) => (
<PostLink key=post.id post=post/>
))
</ul>
</Layout>
);

Index.getInitialProps = async () =>

console.log('> Starting import',);
const client = createClient();
const entries = await client.getEntries(
// some query
content_type:type,
include:2
)

console.log(entries.items[0])
console.log('> Content gotten and written for',)

return someEntryAsProp: entries.items[0] ;
//return ;
;

export default Index


Error:




TypeError: Cannot read property 'someEntryAsProp' of undefined




Can anyone please help me where I am doing wrong?










share|improve this question
















I get the below error when I run "next export". My build is fine but the export fails. I have been following a lot of tutorials but couldn't find a solution. Have I defined my someEntryAsProp correctly?



import Layout from '../components/myLayout.js'
import Link from 'next/link'
import createClient from '../helpers/getcontent';
import type from 'os';


function getPosts()
return [
id:'hello-nextjs' , title:'Hello Next.js' ,
id:'learn-nextjs' , title:'Learn Next.js is awesome' ,
id:'deploy-nextjs' , title:'Deploy apps with Zeit' ,
]

const PostLink = ( post ) => (
<li>
<Link as=`/p/$post.id` href=`/post?title=$post.title`>
<a>post.title</a>
</Link>
</li>
)

const Index = () => (

<Layout>
<h1>My Blog</h1>
<p>someEntryAsProp.fields.title</p>
<ul>
getPosts().map((post) => (
<PostLink key=post.id post=post/>
))
</ul>
</Layout>
);

Index.getInitialProps = async () =>

console.log('> Starting import',);
const client = createClient();
const entries = await client.getEntries(
// some query
content_type:type,
include:2
)

console.log(entries.items[0])
console.log('> Content gotten and written for',)

return someEntryAsProp: entries.items[0] ;
//return ;
;

export default Index


Error:




TypeError: Cannot read property 'someEntryAsProp' of undefined




Can anyone please help me where I am doing wrong?







javascript ecmascript-6 es6-promise next.js contentful






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 6 at 20:56









Heretic Monkey

6,57263571




6,57263571










asked Mar 6 at 20:52









Mateenah MMateenah M

91




91












  • Wouldn't you still have to use this.props.someEntryAsProp ?

    – Strebler
    Mar 6 at 20:57











  • I tried using that, but no luck. Adding . <p>this.props.someEntryAsProp.fields.title</p> gives another error *TypeError: Cannot read property 'props' of undefined *

    – Mateenah M
    Mar 7 at 8:24


















  • Wouldn't you still have to use this.props.someEntryAsProp ?

    – Strebler
    Mar 6 at 20:57











  • I tried using that, but no luck. Adding . <p>this.props.someEntryAsProp.fields.title</p> gives another error *TypeError: Cannot read property 'props' of undefined *

    – Mateenah M
    Mar 7 at 8:24

















Wouldn't you still have to use this.props.someEntryAsProp ?

– Strebler
Mar 6 at 20:57





Wouldn't you still have to use this.props.someEntryAsProp ?

– Strebler
Mar 6 at 20:57













I tried using that, but no luck. Adding . <p>this.props.someEntryAsProp.fields.title</p> gives another error *TypeError: Cannot read property 'props' of undefined *

– Mateenah M
Mar 7 at 8:24






I tried using that, but no luck. Adding . <p>this.props.someEntryAsProp.fields.title</p> gives another error *TypeError: Cannot read property 'props' of undefined *

– Mateenah M
Mar 7 at 8:24













1 Answer
1






active

oldest

votes


















0














You need to pass the props to your page-component as an argument:



const Index = (someEntryAsProp) => (...)





share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031949%2fnext-js-typeerror-cannot-read-property-xxx-of-undefined%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You need to pass the props to your page-component as an argument:



    const Index = (someEntryAsProp) => (...)





    share|improve this answer



























      0














      You need to pass the props to your page-component as an argument:



      const Index = (someEntryAsProp) => (...)





      share|improve this answer

























        0












        0








        0







        You need to pass the props to your page-component as an argument:



        const Index = (someEntryAsProp) => (...)





        share|improve this answer













        You need to pass the props to your page-component as an argument:



        const Index = (someEntryAsProp) => (...)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 10:28









        RobRob

        3,7432230




        3,7432230





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031949%2fnext-js-typeerror-cannot-read-property-xxx-of-undefined%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко