Skip to content

Instantly share code, notes, and snippets.

@shafiqshams
Created April 11, 2017 08:59
Show Gist options
  • Save shafiqshams/b221f32d9e67242279ec672dde49ed64 to your computer and use it in GitHub Desktop.
Save shafiqshams/b221f32d9e67242279ec672dde49ed64 to your computer and use it in GitHub Desktop.
Refactored to Class Based Component.
import React, { Component } from 'react';
import { Text, View } from 'react-native';
class AlbumList extends Component {
render() {
return (
<View>
<Text> AlbumList!!! </Text>
</View>
);
}
}
export default AlbumList;
@shafiqshams
Copy link
Author

Class based Componets are more complex and we write more code.
Lot more capability.
Used for fetching data and they're easier to use to write large components and easier to organize large amount of code with them cuz we get Class based struture and add many helper methods with them.

ES6 Classes extends components.
Render method is must return some amount of JSX.

@shafiqshams
Copy link
Author

Benefits of class based components, Unique advantage over functional components..
called LifeCycle Methods
In functional some data goes in and JSX comes out. but in ClassBased: which have alot more knowledge k kab render hona hai kab remove hona hai.. and notification can be received.
One of the LC method is componentWillMount()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment