react-typescript-todomvc-2022

laststanceMIT活跃维护

用 React 和 TypeScript 实现的 TodoMVC 示例,配套 React Testing Library 测试,适合学习现代前端工程与测试写法。

React TypeScript TodoMVC 2022

1.0.0发布于 2022-06-25 18:05 UTC541star +1 / 7 天119fork同步于 2026-11-10 17:58 UTC

怎么上手

由 README 提炼,执行前请确认
npx degit laststance/react-typescript-todomvc-2022 react-typescript-todomvc-2022
cd react-typescript-todomvc-2022
npm -g pnpm
pnpm i
pnpm start
硬件要求按 README 说明

README 未说明,仅要求 Node.js 版本高于 v18.16.1 LTS

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用最新 React 写法实现的 TodoMVC 示例,帮新手和久未写 React 的人快速上手现代写法

用 React 和 TypeScript 实现的 TodoMVC 示例,配套 React Testing Library 测试,适合学习现代前端工程与测试写法。

核心能力

  • 基于 Vite 构建,启动即热更新开发
  • 用 Recoil 管理 React 状态
  • 用 Styled-Components 写 CSS-in-JS 样式
  • 用 Cypress 做真实浏览器 E2E 测试
  • 用 react-testing-library 做组件集成测试

容易踩的坑

README 中 npm -g pnpm 命令疑似缺少 install,直接执行可能不生效;运行 Cypress 测试前必须先启动 yarn start 开发服务器;README 同时给出 pnpm 和 yarn 两套命令,混用可能造成锁文件不一致

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

3 个版本1.0.0
  1. 1.0.0v1.0.0最新正式版2022-06-25 · 2022-06-25 18:05 UTC
  2. 2020-10-08Migrate @laststance/use-app-state to Recoil2020-10-07 · 2020-10-07 15:17 UTC
    查看更新说明
  3. rename---create-react-app-typescript-todo-example-2020rename repo: react-typescript-todo-example-2020 >>> create-react-app-typescript-todo-example-20202020-03-06 · 2020-03-06 03:00 UTC

    这个版本没有写更新说明。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Project Status from the Author (@ryota-murakami, Aug 16 2023):

    I'm considering continue update as a Client Side SPA or Rewrite this app with Server Components.
    But Server Components doen't meant obsolete Client Side SPA, both archtecture is great option depends on application type, dev team type, each dev's skillset type.

    Might be keep update both archtecture TODO is ideal vision for me unless there are planty rest time.
    Anyway, I thnik was TODO MVC outdated for current JS frameworks.
    I want to renew this project about this winter.


    React TypeScript TodoMVC 2022

    Netlify Status Build Cypress E2E Lint Test code style: prettier Typecheck All Contributors This project is using Percy.io for visual regression testing.

    A Modern Code Style Todo Example 📝

    This project was started with the goal of continue to publish TodoMVC Apps in the latest React writing style.

    When you found React.js on TodoMVC top page, you might seen classic style React.createClass() based source at first.
    I don't complain about it because the old-style codebase React app works all over the world and helps peopleAlmost cases, there is no value that spending time for rerwite new syntax sugar of huge codebase.

    This project aims to assist new React learners and those who have not written React for a long time by providing a handy resource for learning the latest React.js. I'm glad to even the repo could be useful for your learning. 🤗

    Edit react-typescript-todomvc-2022


    Getting Started

    • The app assumes that you have installed Node.js newer than v18.16.1 LTS. If you don't have it yet, follow the official Node.js Doc to install it.
    npx degit laststance/react-typescript-todomvc-2022 react-typescript-todomvc-2022
    
    cd react-typescript-todomvc-2022
    
    npm -g pnpm
    
    pnpm i
    
    pnpm start
    

    after that auto launch todo app on your default browser and code edit ready.


    Stack

    Command

    You can do exact same command with npm, or install yarn easily if you have interest.

    yarn or yarn install

    Install all Node Package Modules that depending this project.

    yarn start

    After that you'll seen the console which are server processes messages.
    Let's follow the message and put in URL http://localhost:3000/ your browsers adressbar,
    and then you'll got todo app as same as Demo. let's modify under the src/ code feel free!!

    yarn build

    Production build that bundled optimization stuff in build directory.

    yarn serve

    Run production build that generated by yarn build.

    yarn lint

    ESLint is at the top. And setup TypeScript ESLint, integrating Prettier as a eslint-plugin-prettier.
    Here is final config list.

    yarn lint:fix

    Run wtih eslint --fix option.
    Actually frequently use for perform Prettier formatting.

    yarn typecheck

    Check TypeScript error whole porject.

    yarn test

    Run Jest.
    Using react-testing-library for component integration testing.

    yarn clean

    Delete node_modules/*, yarn.lock, build/* once.

    yarn prettier

    Run prettier formatting holeproject without all JS/TS files.

    yarn cypress:open

    Cypress is all-in-one E2E Testing tool which can deal testing on real browser.
    This command using Electron by Cypress default.

    yarn cypress:open require yarn start before.

    yarn start # Launch DevServer
    yarn cypress:open
    

    cypress_open

    yarn cypress:run

    Run Cypress with Electron.
    That's same as run all test on cypress GUI after run yarn cypress:open.

    yarn start # Launch DevServer
    yarn cypress:run
    

    yarn cypress:run:headless

    Run Cypress with headless Electron.
    That mean this command complete all on a terminal without GUI.

    yarn start # Launch DevServer
    yarn cypress:run:headless
    

    🗒 Note

    This is not a Best Practice introduction.
    There are tons of effective way to create solid software in JavaScript World, you have a lot of other option based on your preference for approaching where, The Repo is just a style of my favorite.

    "How to combining TypeScript with massive Babel or JavaScript tools ecosystem?"

    I hope this helps you know like that from what I've Published!

    Issues

    Please feel free to post New Issue or Pull Request 🤗

    Questions

    Please feel free to post New Issue or reply on Twitter 🐦

    If you want to get more generally answers, these community are might be helpful 🍻

    LICENSE

    MIT

    Contributors

    Thanks goes to these wonderful people (emoji key):

    This project follows the all-contributors specification. Contributions of any kind welcome!