Because of __NEXT_DATA__
element DOM size is getting very high and it is affecting to the performance. Can anyone plz help me to remove __NEXT_DATA__
from DOM?
I am using full server-side rendering with dynamic routes in Next.js.
TLDR: If you would(/could) remove the __NEXT_DATA__
script tag, React wouldn't be able to hydrate. You either hardcode the data in the page or try to reduce your pageProps
payload, returned from getServerSideProps
.
I came upon this issue also recently, where I asked myself, why would there be a need for the content to be included in the HTML 2 times.
<script>
tag - This is because of the need for rehydration on the client side.revalidate
option, is that the content shouldn't be changing (maybe ever). So in that case, why couldn't we hardcode the data in the page itself. Althought downside of this of course is, having to write it all out manually / download the required content to some JSON / object and then use it in the page like so.__NEXT_DATA__
- by Liran Cohen.