Grokking React Native
0% completed
Using Inline Styles vs. StyleSheet
Should a style live inside the JSX or in a StyleSheet at the bottom of the file? Both work, and both produce the same result on the screen. The choice affects how easy the code is to read, how much you repeat yourself, and, in one specific situation, how often a child component renders.
Readability and Repetition
Here is the same name on Ana's profile card, written both ways.
<Text style={{ color: 'blue', fontSize: 24 }}>Ana Silva</Text> <Text style={styles.name}>Ana Silva</Text>
With one element the difference is small
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%