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!
Similar QuestionsMore questions about React Native
5
Write a React Native animation that spins an image.1
What is the output of the following code?
const App = () => {
const [count, setCount] = useState(0);
return ({
<Text>
The count is {count}
</Text>
<Button onPress={() => setCount(count + 1)}>
Increase
</Button>
});
};
export default App;
1
Which of the following code snippets will print 'Hello World' to the console?1
I can launch the debugger in Chrome from my app, I run `react-native log-ios` from my command line1
Which of the following snippets are valid JSX?