Hi,
How can i set up jQuery object as global in my app?
When I'm using: window.jQuery = window.$ = require('jquery') if i go to different route like /about and refresh the page, then I recive the some error msg like "window object is undefined".
Or maybe some of you have some example repo with how to integrate next and materialize.css ?
Thank you.
Use https://github.com/zeit/next.js/tree/v3-beta/examples/layout-component and define it in the layout component. That should work :)
doesnt work, same issue
@wjelen26 you can't do that because when the page is being server rendered the object window doesn't exists, you can import jQuery and then set it as a global object in the componentDidMount of a layout component, that way you can be sure the window object exists.
Most helpful comment
@wjelen26 you can't do that because when the page is being server rendered the object
windowdoesn't exists, you can import jQuery and then set it as a global object in the componentDidMount of a layout component, that way you can be sure thewindowobject exists.