next js <Script />
组件渲染策略( afterInteracive
, beforeInteractive
, lazyLoad
)和使用带有async
和defer
的普通<script />
标签有什么区别?
afterInteractive
, beforeInteractive
and lazyLoad
handles script and decide when it's loaded (from docs ). It also differ in 'place' where it loads the script. beforeInteractive
loads your script in <head>
of your project. afterInteractive
loads your script in <body>
of your project.
Basically, it's just Nextjs way to handle scripts in your app. Main difference is that you should not use script tag in head ( in Nextjs ) but place it anywhere else and use right strategy so Nextjs knows where to place it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.