Grokking React Native
0% completed
Understanding React Hooks
Here is the same counter written twice. The first version is a class component, the older way to give a component memory:
import { Component } from 'react'; import { Button, Text, View } from 'react-native'; class Counter extends Component { constructor(props) { super(props); this.state = { count: 0 }; this.handlePress = this.handlePress.bind(this); } handlePress() { this.setState({ count: this.state.count + 1 }); } render() { return ( <View> <Text>Count: {this.state.count}</Text> <Button title="Increment" onPress={this
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%