Answer the question
In order to leave comments, you need to log in
Why does Minified React error #321 occur?
I'm trying to get familiar with the useState hook, but I keep getting an error.
Below is the code. What am I doing wrong?
import React, { Component, useState } from 'react'
import { Text, View, StyleSheet, TextInput } from 'react-native'
class BetterInput extends Component {
render() {
const { placeholder, type, restrictions, inputText } = this.props
const [key, setKey] = useState(0);
return (
<View style={styles.wrapper}>
<TextInput
style={styles.input}
placeholder={placeholder}
onChangeText={()=>setKey(key+1)}
></TextInput>
<Text
>{key}</Text>
</View>
)
}
}
const styles = StyleSheet.create({
wrapper: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
input: {
borderColor: 'gray',
borderWidth: 1,
height: 45,
width: 345,
borderRadius: 10,
}
})
export default BetterInput
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question