not found ctx.data
The data set in the handler is not reflected, is there any reason for this?
2 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the code snippet you've provided, it seems that you are trying to access
ctx.data
in your default function Home
, but ctx.data
is not being set in the GET
handler.
In the GET
handler, you are passing an object with a message
property to ctx.render()
, but this does not automatically set ctx.data
. The ctx.render()
function is used to render a page with the given data, but it does not modify the ctx
object itself.
If you want to pass data to the Home
component, you should ensure that the data is being set on the context object properly, which is typically done within the handler functions. However, without further documentation or context, I cannot provide a definitive solution.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice. It's possible that there might be a specific way to handle context data in Fresh that is not covered here.Routes | Fresh docs
Routes are the basic building block of Fresh applications. They are used to define the behaviour the application when a given path is requested.