menu
Channels
Team
Posts
Chat
Members
Info
Show previous messages

July 15, 2019 at 4:26am

Hi everyone, i´m new using Next js and i have a question. What is the best way to set the lang in html tag, i´m already using _document.js but nothing happen, i´m using the _document example from the documention and i just put lang="en" in the Html tag

  • reply
  • like

July 15, 2019 at 1:28pm

Hi guys, quick question: is there a way to get <Link/> components to have cursor: pointer by default? Otherwise I guess I could make a wrapper component, but if there is some prop I could pass it, that would obviously be better

  • reply
  • like

I searched through the docs and couldn't find anything on an API reference for <Link/>

  • reply
  • like
1:28pm

Thanks in advance :)

  • reply
  • like

July 16, 2019 at 3:56pm

@sharad-s replied you on your post

Thanks! getInitialProps did the trick

  • reply
  • like

Hey, seeking a bit of help in setting up calls to my external API. Looking to connect to localhost:5000 on dev and a Heroku instance on prod. I tried using the "with-custom-reverse-proxy" example provided but couldn't get it working

  • reply
  • like

How does Next know which elements can be rendered server-side vs. client-side? I have a page which is rendered server-side on the initial request (as expected) with the exception of the nav bar. What is it about my nav bar that makes Next push it client-side-only?

  • reply
  • like

does your nav bar have any references to window. in it? Typically, that's what kills server side rendering (or any controls that reference the window object)

  • reply
  • like

Hi guys, quick question: is there a way to get <Link/> components to have cursor: pointer by default? Otherwise I guess I could make a wrapper component, but if there is some prop I could pass it, that would obviously be better

I think you're going to need to set up a wrapper, otherwise you can slide in a style prop, style={{cursor: 'pointer'}}. pointer is already the default tho...

Edited
  • reply
  • like

does your nav bar have any references to window. in it? Typically, that's what kills server side rendering (or any controls that reference the window object)

That is probable, in this case. Are there ways to force client-side rendering for certain components? I can't even think of a use-case at the moment, I'm just trying to get a sense for future pitfalls.

  • reply
  • like

I think you're going to need to set up a wrapper, otherwise you can slide in a style prop, style={{cursor: 'pointer'}}. pointer is already the default tho...

Interesting, I wonder why that style isn't applied to any <Link /> components then... I made a wrapper and it works fine, but I used an extra React Fragment < /> around it. I'll try it with just the style prop, thanks!

  • reply
  • like

July 17, 2019 at 7:21pm

Just updated to 9.0.2 and getting an exception now

Class constructor Document cannot be invoked without 'new' Does anyone know a solution for this?

I import like shown below: import Document, { Html, Head, Main, NextScript } from 'next/document';

It's being used as such: class MyDocument extends Document {

Edited
  • reply
  • like

Just updated to 9.0.2 and getting an exception now

Class constructor Document cannot be invoked without 'new' Does anyone know a solution for this?

I import like shown below: import Document, { Html, Head, Main, NextScript } from 'next/document';

It's being used as such: class MyDocument extends Document {

I'm on 9.0.2 with a custom Document and don't see that issue. Any additional info?

  • reply
  • like

Question: is there another mechanism to pass state from MyApp to the getInitialProps function of a page besides tacking additional params onto that function?

  • reply
  • like

e.g., to access the current user's ID while loading page props.

  • reply
  • like

July 18, 2019 at 9:26pm

Is there any way to change to location of the static files? e.g. which route they are served from

  • reply
  • like

July 19, 2019 at 5:24pm

Greetings everyone

  • reply
  • like

I'm at my wits end: I've exported a next.js app, and some of my static files redirect to my homepage (e.g. https://staging.tetnewtechnologies.com/static/img/products/sbc.jpg)

  • reply
  • like

I know static files are exported correctly, see https://staging.tetnewtechnologies.com/static/img/products/firmware.jpg

  • reply
  • like
  • reply
  • like

npm run start works fine however. Does that mean next export is broken?

  • reply
  • like

For future reference: it now works, I believe the issue was invoking next from node_modules/.bin/next --- instead of using npm run ---

  • reply
  • like

Nope, still not working, caches were playing tricks

  • reply
  • like

July 21, 2019 at 3:36am

hi, how would i need to set up now to run a react project from a subdirectory?

  • reply
  • like

it seems like i cant get it to work

  • reply
  • like