r/reactjs • • Jan 26 '25
Needs Help ReactJs+Vite+Tailwind
I am trying to learn ReactJs+Vite+Tailwind at my internship and they told me to try and make a navigation bar in it to get a feel for it. I followed a tutorial from Youtube and replicated the code perfectly but when I try to "npm run dev" the code the locahost only shows a blank white screen. I don't understand what I am doing wrong. Please If you could explain it to me what I am doing wrong.
YouTube Tutorial (they haven't uploaded a github repo to compare the two so you might have to, if you want to, compare with the code in the video. Sorry!)
3
Upvotes
6
u/aminoob123 Jan 26 '25
Can you check your browser dev tools console for any error? Something is not working as expected, if you have the error message then it’ll be easier to debug
10
u/Sebbean Jan 26 '25
Can’t have a router inside ur router bud
11
u/abrahamguo Jan 26 '25
Did you read the error message? Do you have a question about it? It seems pretty descriptive and self-explanatory to me.
1
u/[deleted] Jan 26 '25
I would love some insight into what exactly I am doing wrong.
4
u/Busy_Foundation_4345 Jan 26 '25
are you sure that you finished setting up router in app.jsx?
5
u/nomad_p Jan 26 '25
The most important thing for a new developer is to learn to read the error logs
4
u/oliphant428 Jan 26 '25
The error message you've provided is pretty self explanatory. There is even a stack trace that shows you exactly where the problem is.
2
u/efthemothership Jan 26 '25 edited Jan 26 '25
Instead of router in app.jsx you want to use routes to define your page routes. Check out this page for an example: https://reactrouter.com/start/library/routing. Also, your navbar will be outside of routes. Think of app.jsx as the layout for your app where your navbar is the <header/> and your routes are <main/>.
-3
u/samheart564 Jan 26 '25
Tailwind 4 changed how tailwind works compared to earlier, and since its very recent tutorials might not have updated to account for it.