-
I want to define some shared CSS that is used wherever I display an error message in a form. Which of the two approaches below is recommended? Is one more performant than the other? I'm using TypeScript and React with the new JSX transform. import { css, CSSObject } from '@emotion/react'
export const formErrorCss1: CSSObject = {
fontWeight: 600,
color: 'red',
}
export const formErrorCss2 = css({
fontWeight: 600,
color: 'red',
}) |
Beta Was this translation helpful? Give feedback.
Answered by
Andarist
Oct 26, 2021
Replies: 1 comment 2 replies
-
The second one is "targeted" by our |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
srmagura
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The second one is "targeted" by our
css
helper - this means that we can statically figure out that this particular object is actually meant to be a style and thus we can apply some, minor, optimizations to it. We can also give this a label, source maps, and stuff like that. Note that this sort of thing requires using our Babel plugin.