I am new to React native, while going through the docs I found that in React Native the components are written without implementing the constructor()
function and the states are declared directly in the class. I wonder why that is, as opposed to states being declared inside the constructor like in React.
example from React Native doc:
import React, { Component } from "react";
import { Button, Text, View } from "react-native";
class Cat extends Component {
state = { isHungry: true };
render() {
return (
<View>
...
</View>
);
}
}