menu

Next.js

A place to chat about Next.js and answer questions. For all other ZEIT products, check this out.

Channels
Team
Posts
Chat
Members
Info
Show previous messages

May 14, 2019 at 10:53pm

I have to admit I've forgotten so much about react that I'm having to relearn things

  • reply
  • like

I replaced it with this: index.js:

import withLayout from '../layouts/Basic.js'
const Index = (props) => (
<React.Fragment>
<div>Just a plain div</div>
</React.Fragment>
)
Index.getInitialProps = async (props) => {
console.log(props.req.params);
return props.req.params;
}
export default withLayout(Index);

and the Basic.js is:

import PageHeader from "../components/PageHeader.js"
const withLayout = PageBody => {
class BasicLayout extends React.Component {
static async getInitialProps(ctx) {
const pageProps = await PageBody.getInitialProps && PageBody.getInitialProps(ctx);
return pageProps;
}
render(props) {
return (
<React.Fragment>
<PageHeader />
<PageBody {...props} />
</React.Fragment>
)
}
}
return BasicLayout;
}
export default withLayout;

and it's working just fine, hope it helps if you have a similar problem

  • reply
  • like

May 15, 2019 at 10:14am

Hey all, I'm trying to figure out the most appropriate place/way of adding in stripejs and paypal clientsdk to my next 8 project, i have it in at the minute, using next-head (with a key=), and my browser appears to be re-evaluating the scripts, so I'm currently getting warnings that stripe has loaded multiple times

like-fill
1
  • reply
  • like

Hello

  • reply
  • like

I nee dhelp

  • reply
  • like

we can see that, your keyboard is broken

  • reply
  • like

have you tried turning it off and on again?

  • reply
  • like

May 15, 2019 at 8:08pm

Evening everyone, I've used the with-cookie next example, so I've stored the token in cookie, will the token be sent with each isomorphic-unfetch request by Default ?

Edited
  • reply
  • like

May 16, 2019 at 1:05pm

How to make two separate amp-page and non amp-page in NextJS?

  • reply
  • like

May 17, 2019 at 10:20pm

Hey

  • reply
  • like

May 19, 2019 at 2:59am

how to use external css such as w3css in the nextjs

  • reply
  • like

May 21, 2019 at 10:33am

On my local system, I run the command next -p 3001 to get my dev setup up and running. In this case, if any wrong URL is added, it gets into the _error.js page and there I manage to show a 404 page. After next export and deploying to production, there is no such kind of error. All wrong URL's redirects to home page.

  • reply
  • like

Anything on why its happening?

  • reply
  • like

May 22, 2019 at 4:08am

Hi all wondering if you could shine some light here:

Note: I do not have this issue when not using nextjs

Anytime I import any map with the examples from the viserjs site I get the following error.

ReferenceError: document is not defined
at Object.module.exports (/node_modules/viser/nodemodules/@antv/g2/build/g2.js:12068:13)
at __**webpack\_require**__ (/nodemodules/viser/nodemodules/@antv/g2/build/g2.js:30:30)
at Object.<anonymous> (/nodemodules/viser/nodemodules/@antv/g2/build/g2.js:11787:14)
at __**webpack\_require**__ (/nodemodules/viser/nodemodules/@antv/g2/build/g2.js:30:30)
at Object.<anonymous> (/nodemodules/viser/nodemodules/@antv/g2/build/g2.js:157:18)
at __**webpack\_require**__ (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:30:30)
at Object.defineProperty.value (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:23351:12)
at \_\_webpack\_require (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:30:30)
at Object.<anonymous> (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:2881:11)
at \_\_webpack\_require (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:30:30)
at Object.<anonymous> (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:792:9)
at \_\_webpack\_require (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:30:30)
at Object.defineProperty.value (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:22102:9)
at \_\_webpack\_require (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:30:30)
at Object.<anonymous> (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:48586:10)
at \_\_webpack\_require_ (/node\_modules/viser/node\_modules/@antv/g2/build/g2.js:30:30)

Not sure what to do here. This is a copy of my package.json

{
"name": "with-ant-design-less",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@antv/g2": "^3.5.4",
"@zeit/next-less": "^1.0.1",
"antd": "^3.5.4",
"babel-plugin-import": "^1.7.0",
"bizcharts": "^3.5.3-beta.0",
"deck.gl": "^7.0.8",
"jquery": "^3.4.1",
"less": "3.0.4",
"less-vars-to-js": "1.3.0",
"next": "8.1.0",
"react": "16.8.6",
"react-dom": "16.8.6",
"viser-react": "^2.4.6"
},
"license": "ISC"
}
Edited
  • reply
  • like

Hi everyone. I just wanted to mention that I am going through the learn section of the next website, but the 'lazy loading modules' lesson is not working. Does anyone know if we can fix that.

  • reply
  • like

Greetings! I'd like to know how the React refs system translates into NextJS

  • reply
  • like

May 22, 2019 at 3:21pm

In link tag should I add the class name in the link as <Llink className='myclass'>

  • reply
  • like

or in the <a> tag?

  • reply
  • like

Currently I'm using the links like this

<a href="/index" className="w3-bar-item w3-button w3-hover-yellow w3-round">Home</a>
  • reply
  • like

May 23, 2019 at 1:33pm

@arunkumar413, place it in the DOM element proper

Edited
  • reply
  • like

May 24, 2019 at 1:55am

May 24, 2019 at 4:30pm

Can someone point me in the right direction to learn about building a "tagging" / "related posts" feature for a static export markdown blog?

  • reply
  • like

May 25, 2019 at 12:15pm

Hey everyone, Could we apply With Custom Loading Component (dynamic import) on pages ?

  • reply
  • like

can we make blog with nextjs?

  • reply
  • like