I have been watching a few tutorials recently on RN and I have noticed a few of them do not use class when creating a component, instead, they are using const. The code below shows the homescreen for the app for that particular tutorial. My question is: is there a reason they are doing it this way and not using class? Also, does it matter? Is there a particular reason you would use const instead of class?
const HomeScreen = ({ navigation }) => {
return (
<View>
<Text style={styles.textStyle}>This is the Home Screen</Text>
<Button title="Go to Components Demo"
onPress={() => navigation.navigate('Components')}
/>
<Button title="Go to list demo"
onPress={() => navigation.navigate('List')}
/>
<Button title="Go to Image Screen"
onPress={() => navigation.navigate('Image')}
></Button>
<Button title="Go to Counter"
onPress={() => navigation.navigate('Counter')}
></Button>
<Button title="Colors"
onPress={() => navigation.navigate('Color')}
></Button>
<Button title="Squares"
onPress={() => navigation.navigate('Square')}
></Button>
</View>
);
};
const styles = StyleSheet.create({
textStyle: {
fontSize: 30,
textAlign: "center"
},
});
export default HomeScreen;