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

https://github.com/mamboer/react-router-auth-demo


https://github.com/mamboer/react-router-auth-demo

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# React Router V6 Auth Demo

> This is a demo of how to use React Router V6 to implement the protected routers (Router that needs authentication before rendering).

1. Home page is public.
2. Details page is protected. It will redirect to `/login page` if current user is not authenticated.

## Scripts

- `pnpm dev` - start a development server with hot reload.
- `pnpm build` - build for production. The generated files will be on the `dist` folder.
- `pnpm preview` - locally preview the production build.
- `pnpm test` - run unit and integration tests related to changed files based on git.
- `pnpm test:ci` - run all unit and integration tests in CI mode.
- `pnpm test:e2e` - run all e2e tests with the Cypress Test Runner.
- `pnpm test:e2e:headless` - run all e2e tests headlessly.
- `pnpm format` - format all files with Prettier.
- `pnpm lint` - runs TypeScript, ESLint and Stylelint.
- `pnpm validate` - runs `lint`, `test:ci` and `test:e2e:ci`.