Easy
### Which syntax allows you to apply a style to a component?
Code A:
<MyComponent style="background-color: red">
Code B:
<MyComponent style={{"background-color": "red"}}>
Code C:
<MyComponent style={{backgroundColor: "red"}}>
Code D:
import {StyleSheet} from "react-native";
const styles = StyleSheet.create({
backgroundColor: "red"
})
<MyComponent style={styles}>
Author: Victor SabatierStatus: PublishedQuestion passed 423 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!
1
I can launch the debugger in Chrome from my app, I run `react-native log-ios` from my command line2
How to use StyleSheet in React Native1
Which of the following snippets are valid JSX?2
Which of the following code snippets will print 'Hello World' to the console?2
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;
4
Write a React Native animation that spins an image.1
How to set the background color of a View in React Native