Skip to content

How to use this library with react-frame-component (iframe)? #5271

Answered by Rall3n
doougui asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @doougui,

react-select uses emotion as a CSS-in-JS styling library.

This library exposes API to create a cache with which you can configure the insertion point of the generated stylesheets.

import createCache from '@emotion/cache';
import { CacheProvider } from '@emotion/react';
import Frame, { useFrame } from 'react-frame-component';

const FrameStyleCache = ({ children }) => {
  const { document, window } = useFrame();

  const cache = useMemo(() => createCache({
    key: 'frame-cache',
    container: document.head
  }), [ document ]);

  return <CacheProvider value={cache}>{children}</CacheProvider>
};

const App = () => {
 return <Frame>
    <FrameStyleCache>
      <Main />
    </

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@doougui
Comment options

Answer selected by doougui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants