{"id":18602979,"url":"https://github.com/ymfe/qreact","last_synced_at":"2025-04-06T04:10:46.865Z","repository":{"id":65371709,"uuid":"82019615","full_name":"YMFE/qreact","owner":"YMFE","description":"QReact 是去哪儿网 YMFE 团队推出的 100％ 兼容官方 React 的迷你框架","archived":false,"fork":false,"pushed_at":"2018-07-27T03:49:51.000Z","size":6075,"stargazers_count":308,"open_issues_count":1,"forks_count":21,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-30T03:09:06.782Z","etag":null,"topics":["mini-react","qreact","react"],"latest_commit_sha":null,"homepage":"https://qreact.ymfe.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YMFE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-15T04:17:54.000Z","updated_at":"2024-04-08T08:40:44.000Z","dependencies_parsed_at":"2023-01-19T22:55:27.227Z","dependency_job_id":null,"html_url":"https://github.com/YMFE/qreact","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fqreact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fqreact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fqreact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fqreact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YMFE","download_url":"https://codeload.github.com/YMFE/qreact/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430870,"owners_count":20937874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mini-react","qreact","react"],"created_at":"2024-11-07T02:13:09.078Z","updated_at":"2025-04-06T04:10:46.802Z","avatar_url":"https://github.com/YMFE.png","language":"JavaScript","readme":"# 简介\n\n`QReact`是去哪儿网推出的一款**高度兼容 React**迷你的 React 框架，让 React 在业务线上更具通用价值。\n\n众所周知，React 一直存在体积过大的诟病，集成了许多在线上环境不需要功能。YMFE 团队在熟读其源码的基础上，去芜存精，重新实现了 React 所有公开接口，体积只有 React 的约三分之一，从而解决它在移动端上加载过慢的问题。由于没有使用高级 API，因此只需在 webpack ,uglify 上修改配置，便能运用于 IE8 上，从而解决 PC 端同学使用 React 的问题。\n\n它对比官方 react, preact, inferno, react-lite 等框架，它具有以下优势。\n\n* 对比 `preact`等迷你框架，QReact 的事件系统更为完善，更具扩展性。像 `mouseenter/mouseleave`,`focus/blur` 等不冒泡的事件，`preact` 简单的基于**addEventListener(type, fn, true)**是无法正常运行。\n\n* 对比 `preact`等迷你框架，QReact 在处理混杂着 ref 与生命周期钩子的逻辑时，与官方的行为是保持一致。React.Children 与 React.cloneElement 在 key 生成策略上也是与官方行为一致。其他迷你框架则出入很大，或干脆没有实现。简而言之，QReact 与 React 高度兼容，在细节上做得原汁原味。因此它 99％上运行阿里的**antd**这样复杂的 UI 框架，当然我们不限于此，会努力做到完全兼容。\n\n* QReact 实现了官方 `react/lib` 下的许多子模块，它们的实现也非常简洁，从而整体减少 bundle 的大小。如果没有实现它们，许多第三方库就会直接引用官方提供的 `react/lib` 子模块，但由于迷你 React 们的内部实现与官方不一样，因此即便引用，也会运行出错。其次，RN 也用到它们，，这也为 QReact 支持三端合一的 QRN-WEB 做技术支撑。\n\n* QReact 包含了 `react` 及 `react-dom` 的全部功能，同时有着更小的体积，QReact@2.1.4 的体积为（`minified: 34.45KB gzipped : 12.88KB`），作为对比， `react@16.2.0` + `react-dom@16.2.0` 的体积则大了很多（`minified: 5.1KB + 88.7KB = 93.8KB gzipped: 2.2KB + 28.3KB = 30.5KB`）。\n\n* QReact 支持 IE6 - IE8，详细信息请[参见使用](https://qreact.ymfe.org/documents/IE.html)中的“在 IE 6 - IE 8 及以下使用”。\n\n* QReact 是一个充满活力的库，它的开发版本[anujs](https://github.com/RubyLouvre/anu)几乎每天都有更新，不断跟进官方 React 的新特性，React 16 的一些新功能也渐渐加入。\n\n## 如何使用\n\n详细使用方式请[参见使用](https://qreact.ymfe.org/)。\n\n## 组件规范\n\n为了减少常见的编码错误，请尽量遵循[编码规范](https://qreact.ymfe.org/guide/index.html)。\n\n## 鸣谢\n\nQReact 基于开源项目 [developit preact@7.1.0](https://github.com/developit/preact/tree/7.1.0/) [developit preact-compat@3.14.1](https://github.com/developit/preact-compat/tree/3.14.1) 及 [Facebook React@v15.3.1](https://github.com/facebook/react/tree/v15.3.1)。\n\nQReact 在开发过程，从 preact, react-lite 的源码受到许多启迪，特此鸣谢。\n\n欢迎大家对 QReact 与 anujs 进行试用与提 issue 与 PR！\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymfe%2Fqreact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymfe%2Fqreact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymfe%2Fqreact/lists"}