简体   繁体   English

你可以使用react-core而不使用react-dom

[英]Can you use react-core without react-dom

So i've been reading the Facebook docs on React . 所以我一直在阅读关于React的Facebook文档。 There's a lot of it so I may of missed some however, I read that they're splitting React into react-core and react-dom . 有很多,所以我可能会错过一些,但我读到他们将React拆分为react-corereact-dom

I found this react-core repo: https://github.com/petehunt/react-core 我发现了这个react-core repo: https//github.com/petehunt/react-core

I was wondering, has the split been made now? 我想知道,现在拆分了吗? As in could I use react-core and implement another virtual-dom type library in place of react-dom ? 我可以使用react-core并实现另一个virtual-dom类型库来代替react-dom吗?

Yes, this split has happened as of React 0.14. 是的,这次拆分发生在React 0.14之后。 The two official packages are react and react-dom , though they both still live in the facebook/react repository ; 这两个官方软件包是reactreact-dom ,尽管它们仍然存在于facebook / react存储库中 ; the DOM specific stuff is currently in ReactDOM.js while the shared stuff is exported from ReactIsomorphic.js . DOM特定的东西当前ReactDOM.js而共享的东西是ReactIsomorphic.js导出的 (This is internal, and when using the npm packages, you should just require("react") and require("react-dom") .) (这是内部的,当使用npm包时,你应该只require("react")require("react-dom") 。)

There are already projects taking advantage of this split; 已有项目利用这种分裂; take, for example, react-blessed , a custom renderer for the blessed library: 例如, 反应祝福 ,祝福图书馆的自定义渲染器:

React Blessed Demo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM