-
Notifications
You must be signed in to change notification settings - Fork 756
Warning "Expected server HTML to contain a matching <div> in <div>" #842
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
Comments
We probably do want to be more subtle about when we hydrate vs render. I'd welcome a PR to choose |
Spotted this one as well. We're not pre-rendering any components and this error has started popping up in the console. |
I'm newbie at this gem. first of all, I installed this gem with webpacker and i also meet this issue. So how can I resolve, please tell me detail because I don't understand you said above. thanks in advanced. |
Well, it is an issue within the gem but the idea to hack it for a quick check is Create the file component_mount.rb inside config\initializers Write the same as the original file but you could add below This would work as a data param for JS to check if ReactDOM.hydrate() must be use or to use the ReactDOM.render() method. Now, append this to your \app\javascript\packs\application.js
Reset your server. |
@jsbaltodano , @dwightwatson and @phuctm4192 sorry for causing you all a bug. Thanks a bunch for your help fixing and reporting it all. |
I'm new in this, can someone explain me why I got this error The script that I use is returning a picture, but sometimes the picture is not showing and I got this error:
|
Well I am creating a component with
<%= react_component('NameOfComponent', {}, prerender: false) %>
and React is logging into the console
Warning "Expected server HTML to contain a matching div in div"
For what I seen it does not log it if the component is creating using render instead of hydrate
My question is how can I stop the warning.
I read #828
and then in your code
and I thought, maybe you are forcing the hydrate function.
I did force the same method but without using hydrate and the warning goes away.
System configuration
**Webpacker version 3.0.2:
**React-Rails version 2.4.1:
**Rails version 5.1.4:
**Ruby version2.4.2:
The text was updated successfully, but these errors were encountered: