import React from 'react'
import {Route, Switch, useLocation} from 'react-router-dom'
import {useLayout} from "../context/LayoutContext";
import routes from "./routes";

function Page() {
    const location = useLocation()
    const {states} = useLayout()

    return (
        <div>
            {/*{states.renderHeader()}*/}
            <div>
                <Switch location={location}>
                    {routes.map((route, index) => {
                        return <Route key={`row-${index}`} {...route} />
                    })}

                    <Route component={() => <div>404</div>}/>
                </Switch>
            </div>
        </div>
    )
}

export default Page