update readme

This commit is contained in:
Jo Franchetti 2024-09-26 18:57:17 +01:00
parent 8979ec0efc
commit 49c2782b1d

View File

@ -1,39 +1,45 @@
# React + TypeScript + Vite
# Deno and React.js
This template provides a minimal setup to get React working in Vite with HMR and
some ESLint rules.
## A dinosaur app built with React, Vite and TypeScript
Currently, two official plugins are available:
This demo is a simple React app. It uses Vite as the local server, and is
written in TypeScript. The app is a simple dinosaur app that displays a list of
dinosaurs and allows the user to add a new dinosaur to the list.
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md)
uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc)
uses [SWC](https://swc.rs/) for Fast Refresh
You can follow along with the tutorial on the
[Deno Docs](https://docs.deno.com/runtime/tutorials/how_to_with_npm/react/).
## Expanding the ESLint configuration
## Run the app
If you are developing a production application, we recommend updating the
configuration to enable type aware lint rules:
To run the app, you need to have [Deno](https://deno.land/) installed on your
machine. You can install Deno by running the following command, or following the
instructions in the [Deno docs](https://docs.deno.com/runtime/):
- Configure the top-level `parserOptions` property like this:
```js
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json", "./tsconfig.node.json", "./tsconfig.app.json"],
tsconfigRootDir: __dirname,
},
};
```bash
curl -fsSL https://deno.land/install.sh | sh
```
- Replace `plugin:@typescript-eslint/recommended` to
`plugin:@typescript-eslint/recommended-type-checked` or
`plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install
[eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and
add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends`
list
Once you have Deno installed, you can run the app with the following command:
```bash
deno task dev
```
## Build the app
To build the app, you can run the following command:
```bash
deno task build
```
## Serve the app with Deno
To serve the app with Deno, you can run the following command:
```bash
deno task serve
```
![Deno logo](https://docs.deno.com/img/logo.svg)  💚
![Vue logo by Evan Yu](./src/assets/react.svg)