Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jhoan5/react-router


https://github.com/jhoan5/react-router

Last synced: about 6 hours ago
JSON representation

Awesome Lists containing this project

README

        

# React-Router

## ¿Qué es?

_Es un paquete de React que nos permite crear rutas en nuestra aplicación web para tener SPA(Single Page Application) en vez de MPA(Multiple Page Application)_

_Es decir páginas que no recarguen el navegador y solo cambie la URL y el contenido_

### Instalación npm

```bash
npm install react-router-dom
```

## React router en páginas web

1. Definimos un router:

```JavaScript
import React from "react";
import ReactDOM from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";

const router = createBrowserRouter([
{
path: '/',
element:
errorElement: ,
children:[
{
path:'/contact',
element:
},
{
path:'/about',
element:
},
{
path:'/products',
element:
}
]
}
])
ReactDOM.createRoot(document.getElementById("root")).render(

);
```