npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

router-layout

v1.2.1

Published

`RouterLayout` es una biblioteca de React que proporciona una forma sencilla y eficiente de manejar rutas en aplicaciones React utilizando `react-router-dom`. Esta biblioteca permite la carga diferida de componentes y la gestión de layouts, lo que mejora

Readme

RouterLayout

RouterLayout es una biblioteca de React que proporciona una forma sencilla y eficiente de manejar rutas en aplicaciones React utilizando react-router-dom. Esta biblioteca permite la carga diferida de componentes y la gestión de layouts, lo que mejora la experiencia del usuario al navegar por la aplicación.

Características

  • Carga diferida: Utiliza React.Suspense para cargar componentes de forma asíncrona.
  • Configuración sencilla: Define tus rutas y layouts de manera clara y concisa.
  • Manejo de errores: Proporciona un elemento de error predeterminado para manejar fallos en la carga de componentes.

Instalación

Para instalar RouterLayout, usa npm o yarn:

npm install router-layout

Uso

A continuación se muestra un ejemplo básico de cómo utilizar RouterLayout en tu aplicación React:

import React, { lazy } from 'react';
import { RouterLayout } from 'router-layout';

interface RouteConfig {
    path: string;
    component: React.LazyExoticComponent<React.ComponentType<any>> | any;

}

const Home = lazy(() => import('@/pages/Home'));
const About = lazy(() => import('@/pages/About'));
const Contact = lazy(() => import('@/pages/Contact'));

const routes: RouteConfig[] = [
    { path: '/', component: Home },
    { path: '/about', component: About },
    { path: '/contact', component: Contact },
];

const SimpleLayout = ({ children }: { children: React.ReactNode }) => (
    <div>
        <header>
            <nav>
                {/* Links a las rutas */}
            </nav>
        </header>
        <main>{children}</main>
        <footer>
            {/* Footer */}
        </footer>
    </div>
);

const App = () => (
    <RouterLayout
        routes={routes}
        layout={SimpleLayout}
        fallback={<div>Loading...</div>}
    />
);

export default App;

Propiedades

  • routes: Un array de objetos que define las rutas. Cada objeto debe contener:

    • path: La ruta correspondiente.
    • component: El componente que se cargará para esa ruta.
  • layout: (Opcional) Un componente que se usará como layout para las rutas. Si no se proporciona, se renderizará sin un layout.

  • fallback: (Opcional) Un componente que se mostrará mientras se cargan los componentes.