Setup preview mode in REMIX

Hello @dinhhuy.trinh

Thanks for reaching out to us.

I don't have any experience with REMIX, but I'd try to solve this issue.

With the latest @prismicio/client v6, you don't need to use token and documentID. resolvePreviewURL Determines the URL for a previewed document during an active preview session. The result of this method should be used to redirect the user to the document's URL.

When you initiate a client, you need to enable previews from req by the enableAutoPreviewsFromReq method. It allows the client to automatically query content from a preview session if one is active in server environments. This is disabled by default on the server.

In the /api/exit-preview.js file, you set the 'Preview Mode' exit for the current user.

You can see an example of a createClient() function and how it’s used. I have shared zip files in this thread:

Let me know if you have any questions.

Thanks,
Priyanka