Challenge - 5 Problems
Form Handling Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why do we capture user data in form handling?
In a React Native app, why is it important to capture user input from forms?
Attempts:
2 left
💡 Hint
Think about what happens after a user types their name or email in a form.
✗ Incorrect
Capturing user data allows the app to use that information for tasks like logging in, saving preferences, or sending feedback.
❓ ui_behavior
intermediate2:00remaining
What happens when a form input changes?
In React Native, when a user types in a TextInput, what is the usual way to capture that data?
React Native
const [text, setText] = useState('');
<TextInput
value={text}
onChangeText={setText}
/>Attempts:
2 left
💡 Hint
Look at what setText does inside onChangeText.
✗ Incorrect
The onChangeText callback updates the state variable, so the app always knows the current input value.
❓ lifecycle
advanced2:00remaining
When is form data typically submitted in React Native?
Which event usually triggers the form data to be processed or sent after user input?
Attempts:
2 left
💡 Hint
Think about when you finish filling a form and want to send it.
✗ Incorrect
Form data is processed or sent when the user explicitly submits it, usually by pressing a button.
advanced
2:00remaining
How does form data affect navigation in a React Native app?
After a user submits a login form, what usually happens next in the app?
Attempts:
2 left
💡 Hint
Think about what happens after you log in to an app.
✗ Incorrect
Successful form submission often triggers navigation to a new screen, like a home or dashboard screen.
🔧 Debug
expert3:00remaining
Why does this form not capture user input correctly?
What is wrong with this React Native form code that prevents capturing user input?
React Native
const [name, setName] = useState(''); <TextInput value={name} onChangeText={() => setName('')} />
Attempts:
2 left
💡 Hint
Look at what setName is called with inside onChangeText.
✗ Incorrect
The onChangeText callback ignores the input and always resets the state to empty, so user input is lost.