Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.58 KB

FAQ.md

File metadata and controls

66 lines (45 loc) · 1.58 KB

FAQ

Why can't I use shorthand CSS properties?

See Tradeoffs - No shorthands

Why can't I export the value from style9.create?

The value returned from style9.create can be used as a function or as an object with properties. However, the generated code is just a plain object: the function call is transformed by the compiler to a ternary expression. To avoid issues when using the value as a function in places where babel can't track the reference, you have to explicitly make it into a plain object using the spread operator:

export const { ...styles } = style9.create({
  // ...
});

Errors

Could not evaluate value

Babel failed to evaluate a value used in a style definition. Try moving the value directly to the create call.

Unsupported uses

import style9 from 'style9';
import importedColor from './color';

const OBJECT = {
  BLUE: 'blue'
};

const styles = style9.create({
  imported: {
    color: importedColor
  },
  object: {
    color: OBJECT.BLUE
  }
});

Supported use

import style9 from 'style9';

const COLOR = 'blue';

const styles = style9.create({
  constant: {
    color: COLOR
  }
});

Unsupported type

You're using an operator or value type that isn't supported. See Usage guide for supported uses.

Have another question?

Look at the FAQ, search the repo, or ask in discussions.