import React from 'react'
import ReactDOM from 'react-dom/client'
import { createBrowserRouter, Navigate, RouterProvider } from 'react-router-dom'
import Products from "./routes/products/products";
import Layout from "./components/layout";
import productLoader from "./clients/loader"; 
import './index.css'

const routes = [
  {
    path: '/products',
    loader: productLoader,
    element: <Products/>
  },
  {
    path: '/',
    element: <Navigate to='/products'/>
  }
];

const router = createBrowserRouter(routes);

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <React.StrictMode>
    <Layout>
      <RouterProvider router={router}/>
    </Layout>
  </React.StrictMode>
)