Fork me on GitHub

does using StyleSheet.create bring any benefit in Clojurescript (re-natal)?


@madvas: Couldn’t find it it right now - but as far as I remember StyleSheet.create maintains internal buffer of all created styles and returns int identifier for it. Meaning if you have same style applied on multiple components it will be created only once and reused later on.


found it

StyleSheet.create construct is optional but provides some key advantages. It ensures that the values are immutable and opaque by transforming them into plain numbers that reference an internal table. By putting it at the end of the file, you also ensure that they are only created once for the application and not on every render.
so basically memory optimisation plus may save a bit of CPU on a big projects


@artemyarulin: okay, thanks for great explanation 😉