class ShoppingList extends React.Component {
render() {
return (
Shopping List for {this.props.name}
- Instagram
- WhatsApp
- Oculus
)
}
}
A React Component
React | React Native |
---|---|
<div> | <View> |
<span> | <Text> |
<li>,<ul> | <ListView> |
<img> | <Image> |
<DataPicker
data={this.state.date}
mode="date"
timeZoneOffsetInMinutes={this.state.timeZoneOffsetInHours * 60}
/>
Platform Specific
import React from "react";
import { View, Text } from "react-native";
const ViewBoxesWithColorAndText = () => {
return (
Hello World!
);
};
export default ViewBoxesWithColorAndText;
// Define a style...
const HelloMessage = React.createClass({
render: function(){
// Instead of calling createElement, we return markup
return Hello {this.props.name};
};
});
// We no longer need a creatElement call here
React.render(<HelloMessage name="Bonnie" />, mountNode);
JSX (Underlined)
Hello Bonnie
// Define a style...
const style = {
backgroundColor: 'white',
fontSize: '16px'
};
// ...and then apply it.
const tv = (
A styled Text
);
{ background-color : "white"}
⇓
{ backgroundСolor : 'white'}
export default class Home extends Component {
render() {
return (
Basic Header
)
}
const styles = StyleSheet.create({
container: {
paddingHorizontal: 10,
paddingVertical: 10
},
header: {
fontSize: 12,
fontFamily: 'Cochin'
}
})