Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jhoan5/react-router
https://github.com/jhoan5/react-router
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jhoan5/react-router
- Owner: Jhoan5
- License: mit
- Created: 2024-07-07T02:25:01.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-10T14:53:49.000Z (6 months ago)
- Last Synced: 2024-11-06T09:14:20.041Z (about 2 months ago)
- Language: JavaScript
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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(
);
```