WaspW
Wasp15mo ago
Kenny

How do I create a page to display a single Task?

Taking the example 'todo' app as an example. How do I create a page to show a single Task? I've given it a go but I've hit a dead end! Using the example from https://wasp-lang.dev/docs/tutorial/pages I have the following but have no idea how to use RouteComponentProps.

In
main.wasp
I have:

route TaskRoute { path: "/tasks/:taskId", to: TaskPage }
page TaskPage {
  authRequired: true,
  component: import TaskPage from "@src/tasks/TaskPage",
}


in operations.ts I have:

import { RouteComponentProps } from 'react-router-dom';

import { Task } from 'wasp/entities';
import { type GetTask } from 'wasp/server/operations';

export const getTask: GetTask<void, Task[]> = async (args, context) => {
  const task = await context.entities.Task.findUnique({
    where: { id: taskId },
  });
};
In the default main.wasp file created by wasp new, there is a page and a route declaration:
Was this page helpful?