0

at app.js I don't know if I miss something or implementing router incorrectly. But I quite confident that is correct. feel free to ask me if you have more question and I would give more direct answer as I can

import React from 'react';
import './App.css';
import {
  BrowserRouter as Router ,Routes ,Route
} from 'react-router-dom';
import Home from './pages/main';
import PremiumPage from './pages/premium';
import ContactPage from './pages/contact';
import CreatingAccountPage from './pages/process';
import ProfileEditPage from './pages/profile';
import ChatPage from './pages/chat';
import ListPage from './pages/listUsers';
import PrivacyPage from './pages/privacy';
import { AuthContextProvider } from './Context/AuthContext';

function App() {

  return (
    <Router>
        <AuthContextProvider>
        <Routes>
          <Route path='/' element={<Home/>} exact />
          <Route path='/premium' element={<PremiumPage/>} />
          <Route path='/contact' element={<ContactPage/>} />
          <Route path='/process' element={<CreatingAccountPage/>} />
          <Route path='/profile' element={<ProfileEditPage/>} />
          <Route path='/chat' element={<ChatPage/>} />
          <Route path='/listUsers' element={<ListPage/>} />
          <Route path='/privacy' element={<PrivacyPage/>} />
        </Routes>
        </AuthContextProvider>
    </Router>
   
  );
}
export default App;

and index.js

import React from 'react';
import App from './App';
import { createRoot } from 'react-dom/client';
import './index.css';

const root = createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
        <App />
  </React.StrictMode>
);
Drew Reese
  • 165,259
  • 14
  • 153
  • 181
  • Does this answer your question? [React Router: Cannot read property 'pathname' of undefined](https://stackoverflow.com/questions/43620289/react-router-cannot-read-property-pathname-of-undefined) – Konrad Sep 18 '22 at 18:45
  • 1
    Can you edit your post to include the full error message and accompanying code stacktrace so we can see where the issue is originating from? I usually see that error when you've rendered a `Link` somewhere and forgot to include a `to` prop. – Drew Reese Sep 18 '22 at 18:46
  • I found it because my AuthContextProvider. thank you all for helping me very much – aozro veymo Sep 18 '22 at 19:28

0 Answers0