Grokking React Native
Vote

0% completed

​

Managing Multiple State Variables

A signup form holds three values, and you can store them in three useState calls or in one object. Both versions work, and this lesson builds the same form each way so that you can compare them and decide.

Three Separate Variables

A component can call useState as many times as it needs. Each call keeps its own value, and React matches each call to its value by order, as the Hooks chapter explained.

import { useState } from 'react'; import { Button, Text, TextInput, View } from 'react-native'; function SignupForm() { const [name, setName] = useState('');

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content