Archived course lesson

Add Update Recipe Page

Part of Frontend Serverless with React and GraphQL

Objective: Create a `my-recipes/[id]` route to allow users to edit their own pages.

Let’s create the my-recipe page which will turn into the update recipe page after we create a component for that in the next step. For now though, we will keep it simple. Create the following file:

import { MainLayout } from '../../components/layout/MainLayout';

const MyRecipe = ({ id }) => {
  return (
    <MainLayout title="Update Recipe">
      <h1>Update Recipe</h1>
    </MainLayout>
  );
};

MyRecipe.getInitialProps = ({ query }) => {
  const { id } = query;
  return { id };
};

export default MyRecipe;