Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose __unsafe_useEmotionCache from @emotion/react #2441

Merged
merged 3 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/forty-pumas-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/react': patch
---

expose \_\_unsafe_useEmotionCache from @emotion/react, see https://github.com/emotion-js/emotion/pull/2441
Andarist marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions packages/react/src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ let EmotionCacheContext: React.Context<EmotionCache | null> =

export let CacheProvider = EmotionCacheContext.Provider

export let __unsafe_useEmotionCache =
function useEmotionCache(): EmotionCache | null {
return useContext(EmotionCacheContext)
}

let withEmotionCache = function withEmotionCache<Props, Ref: React.Ref<*>>(
func: (props: Props, cache: EmotionCache, ref: Ref) => React.Node
): React.AbstractComponent<Props> {
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// @flow
import pkg from '../package.json'
export type { SerializedStyles } from '@emotion/utils'
export { withEmotionCache, CacheProvider } from './context'
export {
withEmotionCache,
CacheProvider,
__unsafe_useEmotionCache
} from './context'
export { jsx } from './jsx'
export { jsx as createElement } from './jsx'
export { Global } from './global'
Expand Down