State Management · Senior · Question 42 of 75

How do you build optimistic UI with a React Router fetcher?

Explanation

The submitted values are available immediately: const done = fetcher.formData ? fetcher.formData.get('done') === 'true' : todo.done. After the action completes and loaders revalidate, the real data takes over.

Further reading

Problem with a question

State Management · Senior · question 42

Test yourself

Take the State Management · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz