Grokking React Native
Vote

0% completed

​

Managing Input State

The two fields in this component look the same on the screen and accept typing in the same way. Only one of them tells your code what the user typed.

import { useState } from 'react'; import { View, TextInput, Text } from 'react-native'; function TwoFields() { const [name, setName] = useState(''); console.log(`render, name = "${name}"`); return ( <View style={{ paddingTop: 60 }}> <TextInput style={{ borderWidth: 1, padding: 10 }} placeholder="Uncontrolled" /> <TextInput style={{ borderWidth: 1, padding: 10 }}

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content