Question from the React Native (Legacy) test

How to use StyleSheet in React Native

Easy

Is there an advantage to writing styles with the StyleSheet API than with objects?

For example:

// with objects
<MyComponent style={{backgroundColor: "red"}}>

// with the StyleSheet API
import {StyleSheet} from "react-native";
const styles = StyleSheet.create({
	backgroundColor: "red"
})
<MyComponent style={styles}>
Author: Victor SabatierStatus: PublishedQuestion passed 376 times
Edit
2
Community EvaluationsNo one has reviewed this question yet, be the first!