Next Js has lots of errors ( I'm new )
Answered
Carolina Dog posted this in #help-forum
Carolina DogOP
import Image from "next/image";
import styles from "./page.module.css";
function Header() {
return
(
<div>
HeaderTxt
</div>
);
}
function Home() {
return (
<main className={styles.main}>
<p>Hello World</p>
<Header />
</main>
);
}
export default Home;I'm trying to learn Next js and I have two errors
1 - is just related to
Header not sure why, i'm following a toturial and the guy did just that2 - I have the other 3 errors that appears in VS that does nothing, the error doesn't stop the page from loading , why is this happening?? it's confusing me
Answered by Carolina Dog
Header mystery was simple
I changed the return of the header function to this
I changed the return of the header function to this
return ( instead of having the bracket on the second line, apparently that is important ...17 Replies
Carolina DogOP
Header mystery was simple
I changed the return of the header function to this
I changed the return of the header function to this
return ( instead of having the bracket on the second line, apparently that is important ...Answer
@Carolina Dog Header mystery was simple
I changed the return of the header function to this
` return (` instead of having the bracket on the second line, apparently that is important ...
that's correct, it's just how javascript works: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return#automatic_semicolon_insertion
weird, i know, but it is what it is.
weird, i know, but it is what it is.
they have been poping up since I installed NextJS
@Carolina Dog what about the other 3 errors
what's your tsconfig.json?
Carolina DogOP
the default options
@Carolina Dog the default options
sounds like it's due to typescript version https://stackoverflow.com/a/78237359
what's the typescript version in your package.json?
Carolina DogOP
then all i can think of is that your editor is buggy or doesn't support typescript v5 yet
@joulev then all i can think of is that your editor is buggy or doesn't support typescript v5 yet
Carolina DogOP
Im using vs 2019
do i need to upgrade it or install a more recent version ?
I don’t know, sorry. I don’t use visual studio
Check its documentation on how to use up to date typescript version
@joulev I don’t know, sorry. I don’t use visual studio
Carolina DogOP
thank you
do u have a better suggestion for react/next thatn Visual studio ?
do u have a better suggestion for react/next thatn Visual studio ?
visual studio code is my go to :)
I just use vscode