Skip to content

Instantly share code, notes, and snippets.

@koenpunt
Last active January 6, 2019 11:37
Show Gist options
  • Save koenpunt/afbe4a3ba264d3eaed2b5f67fc4cb303 to your computer and use it in GitHub Desktop.
Save koenpunt/afbe4a3ba264d3eaed2b5f67fc4cb303 to your computer and use it in GitHub Desktop.
React composition for inheritance
const MyText = ({ style, ...props }) => (
<Text style={[styles.myText, style]} {...props} />
);
const LargerText = ({ style, ...props }) => (
<MyText style={[styles.largerText, style]} {...props} />
);
const styles = StyleSheet.create({
myText: {
fontFamily: 'Arial Black',
fontSize: 14,
},
largerText: {
fontSize: 20,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment