React_Native_Tutorial/js/components/Quote.js

17 lines
594 B
JavaScript
Raw Normal View History

2021-12-29 12:29:29 +01:00
import React, { Component, Fragment } from 'react';
import { Text } from 'react-native'
export default class Quote extends Component {
render() {
2021-12-29 14:06:22 +01:00
const { text, author } = this.props // destructuring
2021-12-29 12:29:29 +01:00
return (
<Fragment>
2021-12-29 14:06:22 +01:00
<Text style={styleText}>{text}</Text>
<Text style={styleAuthor}>&mdash; {author}</Text>
2021-12-29 12:29:29 +01:00
</Fragment>);
}
2021-12-29 14:06:22 +01:00
}
// Styling in React Native mit JavaScript
const styleText = { fontSize: 25, fontWeight: 'bold', color: 'black' };
const styleAuthor = { fontSize: 17, fontsStyle: 'italic', color: 'red' };