Commit e438efa6 authored by Nurasyl's avatar Nurasyl

update

parent 8f61cc6a
...@@ -6,7 +6,6 @@ import { NotFound } from './components/NotFound/NotFound'; ...@@ -6,7 +6,6 @@ import { NotFound } from './components/NotFound/NotFound';
import { ContactData } from './containers/ContactData/ContactData'; import { ContactData } from './containers/ContactData/ContactData';
import { Layout } from './components/Layout/Layout'; import { Layout } from './components/Layout/Layout';
import { Orders } from './containers/Orders/Orders'; import { Orders } from './containers/Orders/Orders';
import { Context } from './containers/Context';
function App() { function App() {
return ( return (
...@@ -14,8 +13,7 @@ function App() { ...@@ -14,8 +13,7 @@ function App() {
<Routes> <Routes>
<Route path='/' element={<Layout/>}> <Route path='/' element={<Layout/>}>
<Route index element={<BurgerBuilder/>}/> <Route index element={<BurgerBuilder/>}/>
<Route path='/orders' element={<Context/>}/> <Route path='/orders' element={<Orders/>}/>
<Route path='/order' element={<Context/>}/>
<Route path='/checkout' element={<Checkout/>}> <Route path='/checkout' element={<Checkout/>}>
<Route path='contactData' element={<ContactData/>}/> <Route path='contactData' element={<ContactData/>}/>
</Route> </Route>
......
import React, { useEffect } from "react";
import { useLocation } from "react-router-dom";
export const Context = () => {
const location = useLocation();
useEffect(() => {
console.log(location, 'location');
}, []);
return (
location.pathname === "/order" ?
<div>
Order Page
</div>
:
<div>
Orders Page
</div>
);
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment