No styling when clicking on button or inputing the URL in the browser?? #52167
SummaryI'm using Next.JS 13.4.7 with TypeScript and TailwindCSS. I have the following import Contact from "@/pages/contact"
export default function Layout() {
return (
<main className="flex justify-center p-20 w-full">
<Contact />
</main>
)
}which displays the import TextInput from "@/components/text_input"
import Button from "@/components/button"
export default function Contact() {
return (
<div className="flex flex-col justify-center items-center gap-8 w-full max-w-xl text-slate-700">
<h1 className="text-xl">Personal Information</h1>
{// ...}
<div className="flex w-full justify-end">
<Button href="/work_experience">Next {">"}</Button>
</div>
</div>
)
}When clicking on the button link, I'm redirected to the Why is that? What do I need to do to have styling? Also when I visit the root path and then append Screen.Recording.2023-07-04.at.08.06.13.movAdditional informationNext info output:
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
Binaries:
Node: 19.1.0
npm: 9.6.2
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 13.4.7
eslint-config-next: 13.4.7
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.6 |
Replies: 1 comment 3 replies
|
I think you have a conflict. You have a However, you seen to be using You typically need an import '@/styles/globals.css'
import type { AppProps } from 'next/app'
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}You have the same problem with In short, you are mixing up two technologies. If you want to support I think maybe you wanted to create, contact and work_experience, under Read the docs on how to do routing in the App Dir Router: https://nextjs.org/docs/app/building-your-application/routing/defining-routes |
I think you have a conflict. You have a
pagesdirectory, which tells Next.js that you want a/contactpage using the Pages Dir Router, but you are not doing any Tailwind loading there.However, you seen to be using
appdirectory which uses the App Dir Router. While these can be used in the same app, they need different setups.You typically need an
_appfile, and there you load the globals that injects Tailwind.You have the same problem with
pages/work_experience, there's not_appthat loads Tailwind for that route.