Hooks
Hooks available from neutron.
useLoaderData
Returns the data returned from the route's loader.
const data = useLoaderData<typeof loader>();
useActionData
Returns the data returned from the route's action. Undefined if the action hasn't run yet.
const data = useActionData<typeof action>();
useNavigation
Returns the current navigation state.
const navigation = useNavigation();
// navigation.state: "idle" | "loading" | "submitting"
// navigation.formData: FormData (during submission)
useParams
Returns an object of dynamic route parameters.
const params = useParams();
// params.id
useRevalidator
Allows manual revalidation of loaders.
const { revalidate, state } = useRevalidator();
useRouteError
Returns the error thrown during rendering, loading, or action execution.
const error = useRouteError();