6.5 C
New York
Monday, November 30, 2020

JavaScript: Next.js 8.1 is learning AMP

Must Read

Coronavirus: Is it fooling our body and our behavior? – what NYC scientists have to say?

The hypothesis that the SARS-CoV-2 virus could affect not only the immune system but also the social behavior of...

This is the actual value of planet Earth, according to Scientist

The Earth turned out to be the most expensive planet, at least in the solar system, the astrophysicist emphasized. Astrophysicist...

X-ray analysis of ancient Egyptian mummy reveals a surprising discovery

High intensity X-rays have also revealed a mysterious object that was placed on the girl's abdomen at the time...
Aakash Molpariya
Aakash started in Nov 2018 as a writer at Revyuh.com. Since joining, as writer, he is mainly responsible for Software, Science, programming, system administration and the Technology ecosystem, but due to his versatility he is used for everything possible. He writes about topics ranging from AI to hardware to games, stands in front of and behind the camera, creates creative product images and much more. He is a trained IT systems engineer and has studied computer science. By the way, he is enthusiastic about his own small projects in game development, hardware-handicraft, digital art, gaming and music. Email: aakash (at) revyuh (dot) com

The creators of Next.js have released version 8.1 of the framework for creating server-side applications with React. While in the previous major release the focus was on serverless mode, with which developers can create applications for serverless computing, the implementation of AMP is the main innovation in the now released update.

As a more rigorous version of HTML, AMP is designed to provide websites with more reliable performance and better scalability. Google takes advantage of these advantages, among other things, when loading websites into the result lists of its mobile search. In order to be able to render the AMP pages faster, search engines like Google or Bing usually rely on a dedicated AMP cache.

Support for AMP in Next.js is for individual sites, so developers can integrate AMP into their project step by step. Two approaches are available: hybrid AMP pages, which provide a classic HTML page with an AMP version, and the so-called AMP-first pages. The hybrid approach is recommended, for example, for existing websites that are to be supplemented with an AMP version for playing on mobile devices – for example in the case of mobile search. The standard page retains typical Next.js functions such as client-side routing. To integrate an AMP page, developers use the withAmp function with the option hybrid: true :

// pages / index.js 
function HomePage () { 
  return <p> Welcome to AMP + Next.js. </ p> 
} 

export default withAmp (HomePage, {hybrid: true})

Alternatively, websites with Amp can also generally be created as AMP first pages in order to benefit from their advantages for desktop browsers as well. If users are not dependent on the Next.js runtime in their project, AMP-First can accelerate the overall development process. However, only AMP-compatible components may be used to build the website. The Next.js blog and the documentation websites serve as examples of AMP first pages in productive use.

For more information on creating AMP pages with Next.js, see the NextJS blog. The source code released under MIT license can be found on GitHub. A quick start on the project site will help you get started with Next.js and AMP.

- Advertisement -

2 COMMENTS

Comments are closed.

- Advertisement -

Latest News

Coronavirus: Is it fooling our body and our behavior? – what NYC scientists have to say?

The hypothesis that the SARS-CoV-2 virus could affect not only the immune system but also the social behavior of...

This is the actual value of planet Earth, according to Scientist

The Earth turned out to be the most expensive planet, at least in the solar system, the astrophysicist emphasized. Astrophysicist Greg Laughlin of the University...

X-ray analysis of ancient Egyptian mummy reveals a surprising discovery

High intensity X-rays have also revealed a mysterious object that was placed on the girl's abdomen at the time of mummification. An Egyptian mummy from...

Scientists warn of the danger of vitamin D deficiency

A severe deficiency of vitamin D affects many aspects of our health, but above all the bones and muscles. Not treating this problem over the...

In the UK, a millennial tree changes sex

One of the oldest trees in the UK has changed its sex. It is an ancient yew tree that surrounds the church of St. Meugan,...
- Advertisement -

More Articles Like This

- Advertisement -