Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] better example for babel plugin's hoist option #494

Closed
Andarist opened this issue Dec 18, 2017 · 1 comment · Fixed by #514
Closed

[docs] better example for babel plugin's hoist option #494

Andarist opened this issue Dec 18, 2017 · 1 comment · Fixed by #514

Comments

@Andarist
Copy link
Member

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 })
@emmatown
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants