This question is similar to Is Nuxt.js (not pure Vue) check, but about React/Next, not Vue/Nuxt.
So, is there a way to check is Next.js is being used?
Where I can get the constant similar to __IS_NEXT_JS__
or function for checking for the Next.js?
import { BrowserRouter as Router, Route as ReactLink } from 'react-router-dom';
import { Link as ReactLink } from 'react-router-dom';
import NextLink from 'next/link';
// ....
{
__IS_NEXT_JS__ ? // Warning: this constant is hypothetical
<ReactLink href="/">
<a>Home</a>
</ReactLink>
<NextLink href="/">
<a>Home</a>
</NextLink>
}
This is actual for UI/UX frameworks where it is unknown at advance, will be this framework used with Next.js or pure React.