relay README

The project's README from github.com/facebook/relay. As one markdown file: README.md.

Relay · GitHub license npm version

Relay is a JavaScript framework for building data-driven React applications.

See how to use Relay in your own project.

Example

The relay-examples repository contains an implementation of TodoMVC. To try it out:

git clone https://github.com/relayjs/relay-examples.git
cd relay-examples/todo
yarn
yarn grats
yarn relay
yarn dev

Then, just point your browser at http://localhost:5173.

Contribute

We actively welcome pull requests, learn how to contribute.

Users

We have a community-maintained list of people and projects using Relay in production.

License

Relay is MIT licensed.

Thanks

We'd like to thank the contributors that helped make Relay in open source possible.

The open source project relay-hooks allowed the community to experiment with Relay and React Hooks, and was a source of valuable feedback for us. The idea for the useSubscription hook originated in an issue on that repo. Thank you @morrys for driving this project and for playing such an important role in our open source community.

Thank you for helping make this possible!

relay (facebook/relay)

Searching Database…

19K ·GitHub
这是什么?Relay 是一个用于构建数据驱动 React 应用的 JavaScript 框架:你用 GraphQL 声明组件需要哪些数据,由 Relay 来决定如何以及何时去获取这些数据。
它的数据处理方式和常规的 React 做法有什么不同?它是声明式且数据与视图放在一起的:不用以命令式的方式去调用数据存储,而是在依赖这些数据的视图旁边直接声明数据需求,这样查询和界面始终在一起,更容易理清思路。
我该怎么试用它?克隆 relay-examples 仓库——里面有一个可以运行的 TodoMVC 实现,运行后在浏览器里打开即可。README 里还有在自己项目中使用 Relay 的文档链接。
用它需要一个 GraphQL 后端吗?需要。GraphQL 是读取和写入的共同约定——你用 GraphQL 查询声明数据需求,用 GraphQL mutation 修改数据——所以你的应用要对接一个 GraphQL API。
在数据变更(mutation)方面它能给我带来什么?自动的数据一致性、乐观更新和错误处理,客户端和服务端的 mutation 都支持,而且全部以 GraphQL mutation 的形式表达。
Relay 真的有在生产环境中使用吗?有——仓库里维护着一份社区整理的名单,列出了在生产环境中使用 Relay 的个人和项目,而且这个项目从 2015 年起就在 GitHub 上了。
GitHub 显示主要语言是 Rust——Relay 到底是 Rust 还是 JavaScript?你安装和使用的代码是 JavaScript——通过 npm 包配合 Babel 接入 React 应用。Rust 只是 GitHub 统计出的仓库主要语言,反映的是它的编译器部分。
它能帮助减少网络流量吗?可以——Relay 会把你的查询合并成高效的网络请求,只获取应用真正需要的数据。
What are similar projects?hyperapp, gatsby, riot, vuex, nuqs, marked, formily, marko
Creator
facebook
Size
7 GB
Stars
19K
Age
11y
Commits · 90 Days