Learning Objectives

Routing in a single-page application (SPA) with react-router-dom

  • Implementing security in a React application with JWT
  • Define what React Router is and its purpose in a React application.
  • Explain the difference between client-side routing and traditional server-side routing.
  • Define routes using components and utilize the exact prop to match routes precisely.
  • Implement navigation using components.
  • Understand and implement dynamic query parameters and access query parameters within components.
  • Set up and manage nested routes and compose complex layouts with nested route structures.

Security in a React application

  • Define JSON Web Tokens (JWT) and their role in authentication.
  • Explain the structure of a JWT (header, payload, signature).
  • Explain the purpose of Same Origin Policy and CORS.
  • Describe the typical flow of using JWTs for user authentication in a React application.
  • Explain the role of localStorage in storing JWT tokens.
  • Compare and contrast localStorage with other storage options (e.g., cookies).
  • Retrieve the JWT token from localStorage upon user login.
  • Attach the token to HTTP requests for authenticated API calls.

Top

3. semester efterår 2024