In more complex cases, especially when you need to style multiple DOM elements in one component, or when using styles that depend on properties and/or state, you should create a helper function that returns an object of styles. This function should also be wrapped in the `stylesFactory` helper function, which will provide basic memoization.
In more complex cases, especially when you need to style multiple DOM elements in one component, or when using styles that depend on properties and/or state, you should create a helper function that returns an object of styles. This function should also be wrapped in the `stylesFactory` helper function, which will provide basic memoization.
Let's say you need to style a component that has a different background depending on the theme:
Let's say you need to style a component that has a different background depending on the `isActive` property :
```tsx
```tsx
importReactfrom'react';
importReactfrom'react';
...
@@ -56,22 +60,13 @@ import { css } from 'emotion';
...
@@ -56,22 +60,13 @@ import { css } from 'emotion';