-
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.
Replies: 1 comment 2 replies
-
The second one is "targeted" by our |
Beta Was this translation helpful? Give feedback.
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.