|
1 |
| -# React + TypeScript + Vite |
| 1 | +# petmemo |
2 | 2 |
|
3 |
| -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
| 3 | +A showcase application built with Vite and React. Powered by [The Cats API](https://thecatapi.com/). |
4 | 4 |
|
5 |
| -Currently, two official plugins are available: |
| 5 | +[Live demo](https://petmemo-sarneeh.vercel.app/) |
6 | 6 |
|
7 |
| -- [@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 |
8 |
| -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
| 7 | +## How to run |
9 | 8 |
|
10 |
| -## Expanding the ESLint configuration |
| 9 | +### Run in development mode |
11 | 10 |
|
12 |
| -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: |
| 11 | +``` |
| 12 | +pnpm install |
| 13 | +pnpm dev |
| 14 | +``` |
13 | 15 |
|
14 |
| -- Configure the top-level `parserOptions` property like this: |
| 16 | +### Run in production mode |
15 | 17 |
|
16 |
| -```js |
17 |
| - parserOptions: { |
18 |
| - ecmaVersion: 'latest', |
19 |
| - sourceType: 'module', |
20 |
| - project: ['./tsconfig.json', './tsconfig.node.json'], |
21 |
| - tsconfigRootDir: __dirname, |
22 |
| - }, |
23 | 18 | ```
|
| 19 | +pnpm build |
| 20 | +pnpm preview |
| 21 | +``` |
| 22 | + |
| 23 | +## Technology |
| 24 | + |
| 25 | +Following libraries and technologies were used in this project: |
| 26 | + |
| 27 | +- [React](https://github.com/facebook/react) - UI Library |
| 28 | +- [React Router](https://github.com/remix-run/react-router) - Routing |
| 29 | +- [Zustand](https://github.com/pmndrs/zustand) - State Management |
| 30 | +- [UnoCSS](https://github.com/unocss/unocss) - CSS Framework |
| 31 | +- [Ky](https://github.com/sindresorhus/ky) - HTTP Client |
| 32 | + |
| 33 | +### Rationale |
| 34 | + |
| 35 | +#### Zustand |
| 36 | + |
| 37 | +I heard a lot about Zustand and it's simplicity. As I never had the opportunity to work with it, I decided to check out its capabilities in this project. What I was looking for in a state management for this project was high React integration (e.g. state selector hooks out of the box), strategies for preventing rerenders and easy nested state updates (e.g. [integration with immer](https://github.com/pmndrs/zustand#sick-of-reducers-and-changing-nested-states-use-immer)). |
| 38 | + |
| 39 | +#### UnoCSS |
| 40 | + |
| 41 | +I love the Utility CSS approach and found out that it's very effective in prototyping and generally fast development. It gives a lot of performance benefits out of the box as you only fetch the CSS you use in your markup, and the reusability level is very high. I did choose UnoCSS over [Tailwind](https://tailwindcss.com/) as it is a lot faster (vs Tailwind's JIT), more customizable, and gives some cool features out of the box like e.g. [pure css icons](https://antfu.me/posts/icons-in-pure-css). |
| 42 | + |
| 43 | +## Assets |
| 44 | + |
| 45 | +Icons have been taken from an open-source project called [Lucide](https://lucide.dev/). Integrated easily with the brilliant [UnoCSS icons preset](https://unocss.dev/presets/icons). |
| 46 | + |
| 47 | +## Architecture |
24 | 48 |
|
25 |
| -- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` |
26 |
| -- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` |
27 |
| -- 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 |
| 49 | +For a detailed description and overview of the architecture, check [this document](https://www.craft.me/s/Qb7mtyIAi6s62S). |
0 commit comments