new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

React Router · API · all subjects

hooks & navigation

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

useTransition renamed to useNavigation

The useTransition hook was renamed to useNavigation in React Router. This change was made to avoid confusion with the useTransition hook in React 18 and because 'navigation' is more semantically correct since it represents what you trigger as a result of router.navigate() or useNavigate().

useNavigation hook return structure

The useNavigation() hook returns an object with the following structure: { state: 'idle' | 'loading' | 'submitting'; location: Location; formMethod?: FormMethod; formAction?: string; formEncType?: FormEncType; formData?: FormData; }. The submission property was removed and its properties (formMethod, formData) were flattened directly onto the navigation object.

useRevalidator hook availability

The useRevalidator() hook is available in React Router and addresses long-requested functionality for manually triggering revalidations.

useLoaderData and useActionData backwards compatibility

useLoaderData and useActionData must retain their generic type parameters in Remix, as they are not currently generic in react-router.

useTransition backwards compatibility for Remix

The Remix version of useTransition needs to have submission and type properties added for backwards compatibility. In react-router-dom, Form with method="get" no longer puts the component into a submitting state, so Remix must add this distinction.

Give your agent this brain