react-smart-routes
Version:
A zero-config file-based routing system for React using the src/pages directory, inspired by Next.js.
12 lines (9 loc) • 319 B
JSX
import React from "react";
import { useRoutes } from "react-router-dom";
export const AutoRouter = ({ routes }) => {
if (!Array.isArray(routes)) {
console.error("❌ Error: routes is undefined or not an array.", routes);
return <h1>⚠️ No routes found</h1>;
}
return useRoutes(routes);
};