Re: Remix Admin App - cannot get the "action" Route Module to work

Remix Admin App - cannot get the "action" Route Module to work

droujav
Shopify Partner
2 0 0

I started with the remix template provided by Shopify, I am adding a simple "action" in my app._index.jsx file:

 

export async function action({ request }) {
  return redirect("/app/go_there")
  );
};
 
then here I have a button:
export default function Index() {
  return (
    <div>
      <Form method="post">
        <input type="text" name="title" />
        <button type="submit">Create Todo</button>
      </Form>
    </div>
  );
}
 
I have tried so many variations, but I keep getting this error when I pressed the button:
droujav_0-1723231997606.png

 

I am going nuts... any idea? thanks

 
 
Replies 2 (2)

Serj94
Shopify Partner
33 4 5

Maybe you need the loader? https://remix.run/docs/en/main/route/loader

Watch videos also 👀

 

If you are a new in apps, follow the course https://shopify.dev/docs/apps/build/build?framework=remix

If this helped, please show your appreciation by giving this answer an upvote and marking it as the solution.
*Limited-time offer! Free consultation in my bio.
droujav
Shopify Partner
2 0 0

Hi, yes the loader works great. It is the "action" that does not. I did follow the course and watched videos... it looks so simple but does not work for "action"