title: Recoil - TypeError: dispatcher.useSyncExternalStore is not a function
body: <p>I've found some posts that talk about this error in regards to <a href="https://stackoverflow.com/questions/71925618/uncaught-typeerror-dispatcher-usesyncexternalstore-is-not-a-function">Redux</a> (where the issue is that Redux isn't supported with React 18), but not Recoil.</p>
  <p>I'm able to add the RecoilRoot tag in and get everything to run properly, until I add useRecoilValue or useRecoilState, then I get this error:</p>
  <p><a href="https://i.stack.imgur.com/A5hij.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A5hij.png" alt="console error" /></a></p>
  <p>Here's my button.js</p>
  <pre><code>import React from &quot;react&quot;;
  import { useRecoilValue } from &quot;recoil&quot;;
  import { buttonActiveState, buttonDisabledState } from &quot;../atoms&quot;;
  
  function Button(props) {
    const isButtonDisabled = useRecoilValue(buttonDisabledState);
    const isButtonActive = useRecoilValue(buttonActiveState);
    return (
      &lt;button
        className={getClassName(props, isButtonActive)}
        type=&quot;button&quot;
        disabled={isButtonDisabled}
      &gt;
        {props.copy}
      &lt;/button&gt;
    );
  }
  
  function getClassName(props, buttonActiveState) {
    let className = &quot;btn btn-primary &quot;;
    if (props.className) {
      className += props.className;
    }
    if (buttonActiveState) {
      className += &quot; active&quot;;
    }
    return className;
  }
  
  export default Button;
  </code></pre>
  <p>and the atoms.js</p>
  <pre><code>import { atom } from &quot;recoil&quot;;
  
  export const buttonActiveState = atom({
    key: &quot;buttonActiveState&quot;,
    value: false,
  });
  
  export const buttonDisabledState = atom({
    key: &quot;buttonDisabledState&quot;,
    value: false,
  });
  </code></pre>
  <p>(RecoilRoot is wrapped around the content in the return statement for my main component)</p>
  <p>I can't find anything about this online. How can I fix it?</p>