Home > Back-end >  react js compilation is successful but no output
react js compilation is successful but no output

Time:12-20

build successful but no output here is the git repo link https://github.com/ganu123/my-project I am new in react js please help

CodePudding user response:

I saw the repo and found you didn't wrap your app with Router as you're using Routes

index.js

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter } from "react-router-dom";

ReactDOM.render(
  <React.StrictMode>
<BrowserRouter>
    <App />
</BrowserRouter>
  </React.StrictMode>,
  document.getElementById('root')
);

reportWebVitals();

App.js

import './App.css';
import {Route} from "react-router-dom";
// HOC
import DefaultHOC from './HOC/Default.HOC.js';
import {  Switch } from "react-router-dom";
// Component
import Temp from './components/temp';

function App() {
  return (
    <Switch>
    <DefaultHOC path="/" exact component= {Temp}/>
    </Switch>
  );
}

export default App;
  • Related