Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import React from 'react';
import { BrowserRouter as Router, Route, Routes, useLocation } from 'react-router-dom';
import LandingPage from './components/pages/LandingPage';
import Service from './components/pages/Service';
Expand All @@ -11,9 +11,10 @@ import Footer from './components/Footer';
import { useUser } from './context/userContext';
import ProtectedRoute from './components/ProctedRoutes/ProtectedRoute';

function App() {
// Create a separate component for the main app content
function AppContent() {
const { user, setUserData } = useUser();
const location = useLocation(); // Move this inside the Router
const location = useLocation(); // Now this is correct

return (
<>
Expand Down Expand Up @@ -53,4 +54,13 @@ function App() {
);
}

// Wrap the entire app with Router
function App() {
return (
<Router>
<AppContent />
</Router>
);
}

export default App;