Created
April 11, 2017 08:59
-
-
Save shafiqshams/b221f32d9e67242279ec672dde49ed64 to your computer and use it in GitHub Desktop.
Refactored to Class Based Component.
This file contains 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
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; |
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
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.