Skip to content

Instantly share code, notes, and snippets.

@PavanKu
Created May 19, 2019 18:05
Show Gist options
  • Save PavanKu/3cd90ecf17759f585cf657c53c2c7efc to your computer and use it in GitHub Desktop.
Save PavanKu/3cd90ecf17759f585cf657c53c2c7efc to your computer and use it in GitHub Desktop.
Functional vs Class based component
/* 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