Skip to content

Commit c47c648

Browse files
committed
update release notes
1 parent 7f87e51 commit c47c648

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ function getLoadContext(req, res): unstable_InitialContext {
520520

521521
#### Client-side `context` (unstable)
522522

523-
Your application `loader` and `action` functions on the client will now receive a `context` parameter. This is an instance of `unstable_RouterContextProvider` that you use with type-safe contexts (similar to `React.createContext`) and is most useful with the corresponding `middleware`/`clientMiddleware` API's:
523+
Your application `clientLoader`/`clientAction` functions (or `loader`/`action` in library mode) will now receive a `context` parameter on the client. This is an instance of `unstable_RouterContextProvider` that you use with type-safe contexts (similar to `React.createContext`) and is most useful with the corresponding `unstable_clientMiddleware` API:
524524

525525
```ts
526526
import { unstable_createContext } from "react-router";
@@ -529,17 +529,18 @@ type User = {
529529
/*...*/
530530
};
531531

532-
let userContext = unstable_createContext<User>();
532+
const userContext = unstable_createContext<User>();
533533

534-
function sessionMiddleware({ context }) {
534+
const sessionMiddleware: Route.unstable_ClientMiddlewareFunction = async ({
535+
context,
536+
}) => {
535537
let user = await getUser();
536538
context.set(userContext, user);
537-
}
539+
};
538540

539541
export const unstable_clientMiddleware = [sessionMiddleware];
540542

541-
// ... then in some downstream loader
542-
function loader({ context }) {
543+
export function clientLoader({ context }: Route.ClientLoaderArgs) {
543544
let user = context.get(userContext);
544545
let profile = await getProfile(user.id);
545546
return { profile };

0 commit comments

Comments
 (0)