Git Product home page Git Product logo

electron-react-vite's Introduction

React-Electron-Template

简介

一个基于react18和electron的模板项目,包含了常用的状态管理和UI库,可以直接使用。

状态管理

react的常用状态管理有:redux, mobx, hox, zustand
redux又二次封装得到:redux tookit, dva, rematch

由于我是从vue3转过来的,期望对齐vue3的pinia,尽可能做到统一,降低学习成本。
看了许多状态管理库,经过筛选,最后锁定在zustandhox,再仔细对比后选择了hox

项目结构

vite-reactts-electron-starter
├─ electron // electron相关配置
├─ main // electron打包产物
├─ src // 主要代码入口
│ ├─ api // 服务器接口api
│ ├─ common // 静态资源
│ │ ├─ images
│ │ └─ styles // 全局样式
│ ├─ components // 组件
│ ├─ pages // 页面
│ ├─ router // 路由
│ ├─ store // 状态管理器
│ ├─ types // TS类型
│ ├─ App.tsx
│ ├─ index.html
│ ├─ index.scss
│ └─ main.tsx // 入口文件
├─ LICENSE.md
├─ package.json
├─ pnpm-lock.yaml
├─ postcss.config.js
├─ README.md
├─ tailwind.config.js
├─ tsconfig.json
├─ vite.config.ts
└─ yarn.lock

快速开始

  1. 克隆仓库
git clone https://github.com/Minf97/electron-react-vite.git
  1. 安装依赖
// cnpm i 或者 yarn都可
// 似乎npm和cnpm会有node报错问题,建议pnpm
pnpm install
  1. 运行项目
npm run dev

技术栈

参考文章

踩坑记录

  1. 调整antdIcon大小需要调整fontSize而不是宽高

electron-react-vite's People

Contributors

ambarvm avatar damianel avatar dev-sr avatar maxstue avatar minf97 avatar wutaobang avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

wutaobang

electron-react-vite's Issues

如何最小代码侵入性解决react样式污染?

除了CSS Module、CSS In JsStyleName,还有什么方案解决样式污染?

以上提到的三种方案都需要更改原先的 className 写法,在我看来这是无法接受的缺陷。

有没有插件允许我们不用修改写法,像vue3一样写一个scoped即可解决样式污染?
又或者vscode是否有插件支持StyleName的语法提示?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.