Next.js utilities for @digigov projects.
Included,
-
common
_app
and_document
components with support for,- SSR style handling.
-
@digigov/ui/app/App
component. - use
@digigov/ui/navigation/Link/LinkProvider
to setnext/Link
as the default Link component across app.
-
react-i18next initializer
$ yarn add @digigov/nextjs
Create _app
and _document
components,
pages/_app.js
import initI18n from '@digigov/nextjs/i18n';
import el from '../locales/el';
initI18n({
el: {
translation: el
}
});
import App from '@digigov/nextjs/App';
export default App;
pages/_document.js
import Document from '@digigov/nextjs/Document';
export default Document;
next.js
spawns two transpilation processes for SSR and client code using
different configuration options. _app
, _doc
are provided as raw .tsx
modules to prevent transpilation conflicts. You need to modify next.js
webpack configuration to include @digigov/nextjs
components as though they
where located in locally in your project.