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
chore: improve React 18 support #72
chore: improve React 18 support #72
Conversation
import * as React from 'react'; | ||
|
||
// @ts-expect-error | ||
export const useInsertionEffect = React['useInsertion' + 'Effect'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this string concat is done to prevent issues with transpiling/bundling. Would be nice to have a comment explaining this, it wasn't obvious to me until I read this emotion PR.
37438c6
to
c0dac7e
Compare
📊 Bundle size reportUnchanged fixtures
|
f97f479
to
dd1d4e7
Compare
packages/core/src/makeStyles.ts
Outdated
renderer.insertCSSRules(cssRules!); | ||
insertionCache[rendererId] = true; | ||
} | ||
insertStyles(renderer, dir, cssRules!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe at this point the computeClasses
function name above was never quite clear. This step does not only compute the classes but also inserts them to DOM
ab3c8ed
to
d12c92d
Compare
d12c92d
to
8b59d72
Compare
Fixes #40.
This PR improves compatibility of
@griffel/react
by using a custom insertion factory that usesuseInsertionEffect
when it's available.