import { createBrowserRouter, RouterProvider, Navigate } from 'react-router';
import List from './List';
import Form from './Form';
import Layout from './Layout';

const router = createBrowserRouter([
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: '/list',
        element: <List />,
      },
      {
        path: '/form',
        element: <Form />,
      },
      {
        index: true,
        element: <Navigate to="/list" replace />,
      },
    ],
  },
]);

const App: React.FC = () => {
  return <RouterProvider router={router} />;
};

export default App;

