Why is ReactDOM a separate file on the CDN?
See original GitHub issueWhen loading React from the CDN, we now need to include two separate files:
<script src="https://fb.me/react-0.14.2.js"></script>
<script src="https://fb.me/react-dom-0.14.2.js"></script>
Why? Given the primary use of React via CDN is for browsers, shouldn’t we bundle them together? When would you ever load react-0.14.2.js
via the CDN without loading react-dom-0.14.2.js
?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:6
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Why React and React-DOM Libraries are Kept in Two ...
We might have noticed that, even though React and React-DOM are used together always, we include them from two separate packages.
Read more >CDN Links - React
Both React and ReactDOM are available over a CDN. To load a specific version of react and react-dom , replace 18 with the...
Read more >ReactDOM render not working using CDN links - Stack Overflow
I do see a warning from React that ReactDOM.render is deprecated, but not sure if that's related. – Alan Friedman. Jul 7 at...
Read more >How React.js CDN Makes Your Life Incredibly Easier - Copycat
In this blog post, we will discuss all about setting up reactjs cdn and how it is beneficial to your react project.
Read more >What is CDN React DOM and Its Benefits
Other Benefits of CDN React DOM · IPV4/IPV6 Dual-Stack Network · Intuitive User Interface · Real-time Data and Information · Developer-Friendly · Instant...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure, but providing two globals (
React
andReactDOM
) doesn’t mean they need to be in two totally separate JavaScript files 😃Since loading both is the most common case right now, wouldn’t it be beneficial to provide one .js file with both (say react-full.js or something like that)?
To take that even further: this could actually make React a lot smaller since with an optional flag, since its opens up the possibility of only sending in custom builds which open up browser specific requirements, removing all compatibility layers. So, based on the
User-Agent
, the react dependency served directly from the CDN can be only specific to that particular browser. Less code, smaller network packages, lesser latency, more smiling faces.React has to starting modularizing even more for that, allowing custom builds removing compatibility layers, but this could be a very interesting area to explore.