use-stripe-subscription icon indicating copy to clipboard operation
use-stripe-subscription copied to clipboard

Support for Nextjs App Router?

Open tillka opened this issue 2 years ago • 3 comments

Hi,

I found this package as it is 100% what I need to connect my app with stripe and clerk. I tried to follow the demo but it is using the old /pages router. With my limited knowledge, I tried to re-factor it but failed in the end, as the SubscriptionProvider is using createContext - which is only possible in Client Components not Server Components.

Before I try to find another solution, are you thinking of refactoring this package to use the new app router?

Best

Till

tillka avatar Sep 04 '23 16:09 tillka

+1 for this issue @colinclerk

jgreens avatar Nov 28 '23 15:11 jgreens

Same! following this

simonMoisselin avatar Dec 04 '23 08:12 simonMoisselin

my solution was to create a layout with SubscriptionProvider inside the children app folders, only the ones that needs SubscriptionProvider`, to know if user is subscribed.

Also I can use 'use client'; for those layouts (not the case for the root layout that's the trick) Probably not optimal if you want to know for all the pages, bug it should work

simonMoisselin avatar Dec 04 '23 08:12 simonMoisselin