-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Render only in client side #863
Comments
How about partial render on client side? componentDidMount() {
if (__CLIENT__) {
// initialize google map here
}
} |
@micooz i tried very similar to your answer but get warning
but i get warning
|
I would recommend using |
@quicksnap i get this waring when i used setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the undefined component. |
@NourSammour I don't think you need ...
state = {
scriptjsLoaderEnabled: false
};
componentDidMount() {
// initialize the lib here?
// ...
this.setState({scriptjsLoaderEnabled: true})
}
render() {
if (!this.state.scriptjsLoaderEnabled) {
return (<div/>);
}
return (
<ScriptjsLoader ... )
} |
@Dattaya Thanks, it's work perfectly 👍 |
Hi, im trying to get this working, I have the same problem described above. Ive tried the solution with componentDidMount but the error persist. Maybe Im missing something. https://github.com/OkuraSt/example-maps The Map component is added on Home.js. |
@OkuraSt try this
|
@NourSammour Thanks man,
I don't know if I'm missing something very easy, but the error is persisting. |
I could get it working by setting the height and width of the container element to a specific number of pixels. Now Im tryng to resize it to 100% height. I appreciate any help. Thanks |
Hey, guys, @OkuraSt, @NourSammour, @Dattaya! Does anybody see the problem when you use
As you can see, on the server side my component is simple Does this case make the React to re-render the whole DOM-tree and all server side rendering become a unuseful stuff or it just tries to re-render only this specific component? Thanks a lot. |
Hi, @Znack. This shouldn't be the case, unless you use |
@Dattaya, yep, actually I used |
@Dattaya You can make another function and eslint won't trigger
|
Thank you, @gabriel-miranda, good to know. |
Thank you, @gabriel-miranda, @Dattaya, I also suppose it is not the big deal to use setState for this particular case, so I have used comment |
is it possible to trigger
render
only in client side, not on the serveri'm trying to use this example (google map)
http://tomchentw.github.io/react-google-maps/async/
my goal is to load the google map library and then render the map on the client side only
Any help?
The text was updated successfully, but these errors were encountered: