Next.js Discord

Discord Forum

Help with react components

Unanswered
Korean bullhead posted this in #help-forum
Open in Discord
Korean bullheadOP
components/hero.tsx error while importing react components

70 Replies

Korean bullheadOP
i didnt had the image saved
export default function Hero
u dont need to import react btw
Korean bullheadOP
alr
also, remove the div element and use fragment
export default function Hero() {return (<></>)}
Korean bullheadOP
i used the rafc thing in es7+ extension
ok
@gin
function hero() { return ( <div>hero</div> ); } export default function Hero;
why does it say that?
Korean bullheadOP
my code
show me your code
nono
u dont need to do that
export default function Hero() {return (<></>)}`
copy paste
Korean bullheadOP
ok
in the whole code?
yes
Korean bullheadOP
still
u didnt copy paste it
Korean bullheadOP
the prettier extension did it
u are missing the brackets
Korean bullheadOP
leme disable it
working now
so you issue is fixed?
Korean bullheadOP
ah
💀
u have to import it
u probably forgot
Korean bullheadOP
import Image from "next/image"; export default function Home() { return ( <main className="overflow-hidden"> <Hero /> </main> ); }
i did
u didnt
Korean bullheadOP
how do i do it again
im new to this stuff
how to import a function?
Korean bullheadOP
nvm i got it
@Korean bullhead nvm i got it
cool
dont forget to mark my answer as solution
gives me feedback
Korean bullheadOP
alr
wait did u rightclick on my message?
Korean bullheadOP
bro...
😭
@Korean bullhead Click to see attachment
ah my bad
export default function Hero() {

    return (<>hero</>)
}
Korean bullheadOP
same
why does it say that?
replace #Unknown Channel</> with a div
Korean bullheadOP
ok
and try again
Korean bullheadOP
never saw something like this before
Korean bullheadOP
:/
can u try reinstalling ur project
npx create-next-app@latest
Korean bullheadOP
ok
something gigantically messed up with your ide
Korean bullheadOP
maybe my extensions
ima go sleep n do it tmrw