Clojurians
#cljsrn
<
2016-05-06
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

madvas09:05:43

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

artemyarulin09:05:42

@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.

artemyarulin09:05:14

found it https://facebook.github.io/react-native/docs/style.html#declare-styles

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

madvas09:05:34

@artemyarulin: okay, thanks for great explanation :wink: