Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React + Vite page is not showing anything

I am pretty new to web dev and I am currently trying to build something with React + Vite. But when I run npm run dev the page shows me a completely white screen like this:the page I am writing

And there is no error in the terminal: terminal output

I have no idea where to look But this is my App.jsx: App.jsx This is my Navbar.jsx: Navbar.jsx

like image 728
lichild Avatar asked May 29 '26 21:05

lichild


1 Answers

In My case i follow example : Example Twin + Vite + Emotion + TypeScript

Result is same as you. Nothing show. Code not running and error said "Uncaught ReferenceError: React is not defined"

I fix this with replace " <> " with " <React.Fragment> "

import React , { Fragment } from "react"
              //  ^^^^^^ can use instead of React.Fragment
function App () {
  return (
    <React.Fragment>
     <div> Hello World </div>
    </Reat.Fragment>
  )
}

Anyway this is not correct way to solve this problem. Still wating for another answer.

like image 95
armada45 Avatar answered May 31 '26 20:05

armada45