octo3.O
Denoβ€’2y agoβ€’
2 replies
octo3.

not found ctx.data

The data set in the handler is not reflected, is there any reason for this?
import { FreshContext, Handlers } from "$fresh/server.ts";

export const handler: Handlers = {
  GET: async (_req: Request, ctx: FreshContext) => {
    return await ctx.render({
      message: "Welcome to Fresh"
    });
  },
};

export default function Home(_req: Request, ctx:FreshContext) {
  console.log(ctx.data) // undefined !!!
  return (
    <div >
      {ctx.data.message}
    </div>
  );
}
Was this page helpful?