-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
'data-reactroot' attribute missing in 16.0.0 #10971
Comments
This is an intentional change. https://hackernoon.com/whats-new-with-server-side-rendering-in-react-16-9b0d78585d67 You can add your own |
Hey @carruthe, You can use selector |
Or even spread your app component render() {
return (
<div style={{ position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 }}>
My App
</div>
);
} |
Sorry if it unexpectedly broke anything for you @carruthe! As mentioned it was an implementation detail which shouldn't have been used, though we understand that's easier said than done 😄 The suggestions listed above are hopefully good solutions for you. @gaearon maybe we should add a note about this to the v16 blog post? I'm sure there are others who have been relying on those attributes. |
* Upgrade react * Upgrade depenencies * new react source * remove assertions on data-reactroot see facebook/react#10971 * use React v18's root API * add TextEncoder library * use node polyfill plugin & fast-text-encoder see shakacode/react_on_rails#1457 (comment) * entry for #1290 --------- Co-authored-by: Mostafa Ahangarha <[email protected]>
* Upgrade react * Upgrade depenencies * new react source * remove assertions on data-reactroot see facebook/react#10971 * use React v18's root API * add TextEncoder library * use node polyfill plugin & fast-text-encoder see shakacode/react_on_rails#1457 (comment) * entry for #1290 --------- Co-authored-by: Mostafa Ahangarha <[email protected]>
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
With versions prior to 16, React added a 'data-reactroot' attribute to the generated div wrapping the render. I rely on this attribute in order to select the div with css (in my case to make it height 100% so it fills its container).
e.g.
#root > [data-reactroot] { height: 100%; width:100%; }
With version 16, this attribute no longer appears, and I can't easily select the div with CSS. I can hack it in Javascript, but it was a lot cleaner with the 'data-reactroot' attribute.
Before version 16
##After Version 16

The text was updated successfully, but these errors were encountered: