react-component-page-router v1.2.1
React Component Page Router
A simple & lightweight module to tie together all your React pages.
Description
Simple module/lib that sets up react-router-dom paths & components for your React project. Looks through file structure ~/src/pages and imports all default components from js,jsx,tsx files.
Getting Started
Install with: npm i react-component-page-router
- Create 
pagesdirectory in~/src/or~/of React project & add all complete pages. - Add PageRouter component to index.js or App.js of React project.
 
import { PageRouter } from "react-component-page-router";
ReactDOM.render(
  <React.StrictMode>
    <PageRouter>
      <App />
    </PageRouter>
  </React.StrictMode>,
  document.getElementById("root")
);- Get all page react-router-dom Link elements for navigation
 
import { PageLinks } from "react-component-page-router";
function Nav() {
  const links = PageLinks().map((link) => <div>{link}</div>);
  return <div>{links}</div>;
}
export default Nav;Notes:
Pages will be routed to their relative paths to 'pages' directory (including sub-paths/directories).
ex.
~/src/pages/Home.js-->https://hostname.com/homeex.
~/src/pages/Dashboard/settings.js-->https://hostname.com/dashboard/settingsFiles with name
indexwill be routed to directory pathex.
~/src/pages/Auth/Login/index.js-->https://hostname.com/auth/loginFiles & directories starting with
_will be ignored and treated as privateex.
~/src/pages/_partials/navigation.js--> ignored ex.~/src/pages/Dashboard/_graph.js--> ignored
Help
If error throw about ~/src/pages make sure you have created the pages directory in the correct place.
~/ should be wherever your project's node_modules are located.
Author(s)
Jonathan Eckman- Github - Email
First real open source code. Open for comments and suggestions :)
Idea loosely based off of nextjs routing but logic and framework is completely different