Type to search…

Router

React Router et permet renderitzar un component concret en funció del "path" de la url i navegar entre components.

This page hasn't been translated yet — shown in its original language:Català

Introducció

React Router et permet renderitzar un component concret en funció del “path” de la url.

Això s’aconsegueix creant un conjunt de rutes, on cada ruta és un “mapping” entre el path d’una URL i un component:

Entorn de treball

Crea un projecte amb Deno amb el nom router:

ps
deno init --npm vite --template react-swc-ts react-router

Instal·la la biblioteca react-router:

shell
cd router
deno add --npm react-router
deno add --dev --npm @types/react-router

Ruta

Imagina que tens un component Student (modifica el fitxer App.tsx).

Ruta

tsx
export default function App() {

  return <Student/>
}

function Student() {
  return <h1>Student</h1>
}

You're reading a preview.

Sign in with Google to read the full page. A Google account includes 5 free pages in total; students and teachers read their course pages without limit.

Sign in