-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request to strip data-reactid and return them as an array or string #2761
Comments
A even better solution is to use a string instead of an array and split the string by a delimiter. To lose 2 extra characters for each tag. |
This looks like something gzip should handle quite nicely at the transport level. |
Why not use both and get even better compression? As far as I know browsers have a stream based rendering approach so they probably will get faster rendered. Example: var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/html; charset=UTF-8' });
res.write('<html><head><title>Test</title></head><body><h1>This will be visible at first</h1>');
// Simulate bad connection
setTimeout(function() {
res.write('<h1>This will be visible after the timeout</h1></body></html>');
res.end();
}, 5000);
}).listen(8080); |
#1570 it's easy to reconstruct the IDs during client render, but until React can go all the way (like in the PR), the entire rendered tree would have to be updated with reconstructed |
@syranide Nice! :) |
We don't use IDs anymore so this can probably close. #10339 |
Right now
data-reactid
on every element adds up a lot of unnecessary space for server generated pages.I know that they are still needed to initialize on the browser. My solution minimize the output is that I strip all the
data-reactid
and add them as an array in a<script>
tag at the end<body>
tag. See my example below.Except from example server script:
Except from example client script
Except from example jsx
I think this solution could be done a lot better/safer if its somehow included in the core.
Saved characters is even higher because labels often gets wrapped into
<span>
The text was updated successfully, but these errors were encountered: