Emotion: [docs] better example for babel plugin's hoist option

Created on 18 Dec 2017  路  1Comment  路  Source: emotion-js/emotion

https://github.com/emotion-js/emotion/tree/master/packages/babel-plugin-emotion#hoist

From the given example I'm not sure from where the performance gains are coming from. I guess you mean that it can help if css/styled are used "dynamically" in functions, but in such case it seems that most commonly there would be some dynamic dependency used for object creation and thus making it impossible to hoist, like in this example:

const getClass = props => css({ backgroundColor: '#fff', color: props.color })

Most helpful comment

The main use case for hoist is with the css prop because defining static styles inline is a common pattern with it.

>All comments

The main use case for hoist is with the css prop because defining static styles inline is a common pattern with it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sami616 picture sami616  路  3Comments

artooras picture artooras  路  3Comments

hamlim picture hamlim  路  3Comments

mitchellhamilton picture mitchellhamilton  路  3Comments

smlmrkhlms picture smlmrkhlms  路  3Comments