function SelectorComponent() {
    const [side, setSideState] = useState('A');
    setSide = setSideState;

    // $FlowFixMe[missing-local-annot]
    setB = useRecoilCallback(({snapshot, gotoSnapshot}) => value => {
      gotoSnapshot(
        snapshot.map(({set}) => {
          set(atomB, {value});
        }),
      );
    });

    return useRecoilValue(side === 'A' ? selectorA : selectorB);
  }
this is required as we need the selector accessed below to outlive
the end of this callback so that the async resolution notifies the
store of the resolution and a re-render is triggered. Otherwise, the
selector will be cleaned up at the end of the callback, meaning the
resolution of the selector will not result in a re-render.