Skip to content

React component vs script tag in Nextjs application #292

Answered by orestbida
jkohlin asked this question in Q&A
Discussion options

You must be logged in to vote

In this case you'd make 2 or 3 additional requests (if we also count the stylesheet) which could have been avoided.
You'd also have to add the defer attribute to make sure that the <body> element actually exists.

Using a react component allows you to bundle the scripts + stylesheet and save unnecessary HTTP requests.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jkohlin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants