What Changed?
strongLoader and strongAction functions expose callbacks succeed, fail, and redirect in a well-known object
- Moved to
effect library (away from fp-ts)
- Expose
useRouteLoaderData hook alias
Using the New Callbacks
import { strongLoader } from "remix-strong-routes";
const action = strongLoader<BarResponse, FooResponse, RedirectToLogin>(
async ({ context, request, params }, { succeed, redirect, fail }) => {
// ... Same as before
}
);
import { strongAction } from "remix-strong-routes";
const action = strongAction<BarResponse, FooResponse, RedirectToLogin>(
async ({ context, request, params }, { succeed, redirect, fail }) => {
// ... Same as before
}
);
Using the New Hook
import { StrongComponent } from "remix-strong-routes";
const Component: StrongComponent<FooResponse> = (props) => {
const parentRouteData = parentRoute.useRouteLoaderData();
return <></>;
};