In React, most input components are stateless. An input component typically has a
value prop and a prop prefixed with
onChange, and together these things give us complete control over the input without ever having to access the native UI imperatively.
Here's an example of a text input field.
We introduce a state variable,
text, to store the current value of the input field. We pass
text into the
TextInput as the
value prop, and any time
onChangeText is called, we update call
setText to update our state variable.
We use the useState hook to store the text value. We'll cover this soon.
Want to learn React Native in-depth?