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

Use React Specific Emotion Packages. #291

Closed
azizhk opened this issue Dec 9, 2019 · 0 comments
Closed

Use React Specific Emotion Packages. #291

azizhk opened this issue Dec 9, 2019 · 0 comments

Comments

@azizhk
Copy link
Contributor

azizhk commented Dec 9, 2019

Based on emotion-js/emotion#1644 (comment)

emotion package is framework agnostic.
For usage with React, we have to use @emotion/core, @emotion/styled, create-emotion-server.

css function from emotion returns a string.
css from @emotion/core returns a custom data type.

From: https://emotion.sh/docs/migrating-to-emotion-10
The most significant change in Emotion 10 is that it doesn’t let you easily access the underlying class names. Instead of thinking in class names, you have to think in terms of styles and composing them together (you can still use class names directly if you want to, but you won’t get new features like zero-config server rendering).

extractCritical is slower by its nature (extra work to be done), but it probably isn't slow enough for you to care about it. You can benchmark your case if you want to.

So for these reasons it's better to use the react specific packages @emotion/core, @emotion/styled

Now we are still using a few nested selectors where we use the classnames as strings. We need to phase those out soon.

@zhirzh zhirzh closed this as completed Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants