rsnext/packages/next/next-server/lib/amp.ts
Tim Neutkens 2ba352da39 Move next-server back into next package (#8613)
* Initial move

* Make emitting work

* Update paths

* Remove leftover files

* Add correct externals configuration

* Import correct path

* Update path to work with ts-server test

* Update lib directory

* Compile next-server/lib
2019-09-04 10:00:54 -04:00

15 lines
367 B
TypeScript

import React from 'react'
import { AmpStateContext } from './amp-context'
export function isInAmpMode({
ampFirst = false,
hybrid = false,
hasQuery = false,
} = {}) {
return ampFirst || (hybrid && hasQuery)
}
export function useAmp() {
// Don't assign the context value to a variable to save bytes
return isInAmpMode(React.useContext(AmpStateContext))
}