Home > Net >  React app builds successfully but shows white screen on chrome
React app builds successfully but shows white screen on chrome

Time:01-26

if someone could help that'd be great. I am following a react tutorial except at some point chrome went blank. When I inspect the page, nothing is in the body html tags. The code compiles and builds successfully though. I'm thinking it's a stupid typo or something, but I am no pro. Please let me know if you find my error!

App.js

index.js

homepage index.js

CodePudding user response:

you created the router but no routes. in app.js

import React from "react"
import {
  BrowserRouter as Router,
  Switch,
  Route
} from "react-router-dom"
import Home from './pages'
function App () {
  return (
    <Router>
      <Switch>
        <Route exact path="/">
          <Home />
        </Route>
      </Switch>
    </Router>
  );
}

export default App;

CodePudding user response:

Hi all it was a problem in one of my components. The lack of error messages made me think it had something to do with the construction of the app.

  •  Tags:  
  • Related