# @digigov/nextjs

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 set `next/Link` as the default
    Link component across app.

* react-i18next initializer


## Usage

```shell
$ yarn add @digigov/nextjs
```

Create `_app` and `_document` components,

**pages/_app.js**

```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**
```js
import Document from '@digigov/nextjs/Document';
export default Document;
```


## Drawbacks

`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.
