title: recoil: Duplicate atom key - in nextjs
body: <p>I do use recoil in my nextjs application.
  But if I run next (in dev or production make no difference) I got this error-message:</p>
  <blockquote>
  <p>Duplicate atom key &quot;companyData&quot;. This is a FATAL ERROR in
  production. But it is safe to ignore this warning if it occurred because of
  hot module replacement.</p>
  </blockquote>
  <p>This is the way I've implemented it:</p>
  <p><strong>/src/stores/CompanyStore.js</strong>:</p>
  <pre class="lang-js prettyprint-override"><code>import { useSetRecoilState, useRecoilValue , atom } from 'recoil';
  import config from '../../content/config.yml';
  
  const companyData = atom({
    key: 'companyData',
    default: {...config.company},
  });
  
  export const useSetCompanyData = () =&gt; useSetRecoilState(companyData);
  export const useCompanyData = () =&gt; useRecoilValue(companyData);
  
  
  export default {
    useSetCompanyData,
    useCompanyData,
  };
  </code></pre>
  <p>I use it like this in some components:</p>
  <p><strong>MyComponent.js</strong></p>
  <pre><code>import React from 'react';
  ...
  ...
  
  import {useCompanyData} from '../stores/CompanyStore';
  
  const MyComponent = () =&gt; {
    const classes = useStyles();
    const companyData = useCompanyData();
    const { summary: headline, description } = companyData;
  
  return (&lt;div&gt;&lt;h2&gt;{headline}&lt;/h2&gt;&lt;p&gt;{description}&lt;/p&gt;)
  </code></pre>
  <p>I don't see, why this error-message appears. Might it caused of a bug in nextjs, or did I implement recoil in a wrong way?</p>