Google AMP with React

Harsh Sarohi picture Harsh Sarohi · Apr 12, 2017 · Viewed 25.1k times · Source

We have an isomorphic react App with node. I want to convert some pages to AMP pages. I am confused! Shall we go for a separate AMP version of the app or shall we modify the current app according to Google guidelines for AMP Pages? I can see we have to make a lot of changes in the current app to make an amp compatible version. How should I proceed?

Answer

HaNdTriX picture HaNdTriX · May 2, 2019

Next.js now supports AMP. They provide multiple approaches (AMP-only & AMP-hybrid) to solve this problem. Since you can enable AMP on page level you can slowly migrate to a full AMP website.

Example

// pages/about.js
export const config = { amp: true }

export default function AboutPage(props) {
  return <h3>My AMP About Page!</h3>
}

This way you can support both. React client rendering and pure AMP.

Docs Next.js AMP