I setState show to true inside componentDidMount
and inside render there is an if(this.state.show == true) return(components...)
so what i want is my components should be displayed when page load is completed by next.js.
But for some reason componentdidmount
is called before page is displayed, and component animation starts while page is still loading.So when page is actually displayed,user catches animation at middle of it which i dont want.
My static folder has lots of images so i guess next is loading them and thats why it takes long, but why did componentDidMount
is called before page finishes loading ? (componentDidMount of index.js not components inside its render method)
I disabled ssr for the components but it didnt work.Page i mentioned is not fetching anything from database and getInitialProps is not used.Its just a next.js page with components inside its render method.
By the way i notice this behaviour only on production,when app is actually deployed to remote server since it takes time to load static folder.On localhost this behaviour is not noticeable.