Skip to content

Commit

Permalink
feat: added suspense for Account Routing
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadshakkeerp committed Feb 28, 2024
1 parent 1911e50 commit aceca48
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/pages/Account.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Route, Routes } from "react-router-dom"
import { AccountDetails, Login, Orders, Profile, Rewards, Wishlist } from "../optimazation/AppOptimazation"
import { AccountSidebar } from "../paths"
import { Suspense } from "react"

const Account = () => {
return (
Expand All @@ -10,16 +11,18 @@ const Account = () => {
<AccountSidebar />
</div>
{/* second section */}
<div className="bg-primary w-full xl:xl:w-4/5">
<Routes>
<Route path="/account" element={<AccountDetails />} />
<Route path="/login" element={<Login />} />
<Route path="/profile" element={<Profile />} />
<Route path="/rewards" element={<Rewards />} />
<Route path="/wishlist" element={<Wishlist />} />
<Route path="/orders" element={<Orders />} />
</Routes>;
</div>
<Suspense fallback={<div className="text-center">Loading...</div>}>
<div className="bg-primary w-full xl:xl:w-4/5">
<Routes>
<Route path="/account" element={<AccountDetails />} />
<Route path="/login" element={<Login />} />
<Route path="/profile" element={<Profile />} />
<Route path="/rewards" element={<Rewards />} />
<Route path="/wishlist" element={<Wishlist />} />
<Route path="/orders" element={<Orders />} />
</Routes>;
</div>
</Suspense>
</div>
)
}
Expand Down

0 comments on commit aceca48

Please sign in to comment.