跳转到主要内容
Header

实用命令

启动应用

npx nx start twenty-front

根据API graphql schema重新生成graphql schema

npx nx run twenty-front:graphql:generate --configuration=metadata
npx nx run twenty-front:graphql:generate

代码检查

npx nx run twenty-front:lint # pass --fix to fix lint errors

翻译

npx nx run twenty-front:lingui:extract
npx nx run twenty-front:lingui:compile

测试

npx nx run twenty-front:test # run jest tests
npx nx run twenty-front:storybook:serve:dev # run storybook
npx nx run twenty-front:storybook:test # run tests # (needs yarn storybook:serve:dev to be running)
npx nx run twenty-front:storybook:coverage # (needs yarn storybook:serve:dev to be running)

技术栈

项目有一个干净且简单的技术栈,使用最少的样板代码。 应用 测试 工具

架构

路由

React Router 负责处理路由。 为了避免不必要的重新渲染,所有路由逻辑都在 PageChangeEffectuseEffect 中。

状态管理

Recoil 处理状态管理。 查看最佳实践以获取有关状态管理的更多信息。

测试

Jest 用于单元测试,而 Storybook 用于组件测试。 Jest 主要用于测试工具函数,而不是组件本身。 Storybook 用于测试隔离组件的行为,以及展示设计系统。