1function Form() {
2 // 1. Use the name state variable
3 const [name, setName] = useState('Mary');
4
5 // 2. Use an effect for persisting the form
6 useEffect(function persistForm() {
7 localStorage.setItem('formData', name);
8 });
9
10 // 3. Use the surname state variable
11 const [surname, setSurname] = useState('Poppins');
12
13 // 4. Use an effect for updating the title
14 useEffect(function updateTitle() {
15 document.title = name + ' ' + surname;
16 });
17
18 // ...
19}