Created
May 19, 2019 18:05
-
-
Save PavanKu/3cd90ecf17759f585cf657c53c2c7efc to your computer and use it in GitHub Desktop.
Functional vs Class based component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Class based component */ | |
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
export default class Greeting extends Component { | |
render() { | |
return ( | |
<Text>Hello {this.props.name} !</Text> | |
); | |
} | |
} | |
/* Functional component */ | |
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
export default function Greeting(props) { | |
return ( | |
<Text>Hello {props.name} !</Text> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment