Closed kadams54 closed 5 years ago
why is this PR not merged yet? @Luehang
@kadams54 would you know any workaround? Because of this, I cannot deploy to Netlify. Imagine if this npm became unmaintained, we would need to create a new npm package?
The following changes is unstable for some of the use cases.
Next update will have SSR support. The update release will be soon after thorough testing with many use cases.
I found a workaround for the SSR: use this: https://github.com/jamiebuilds/react-loadable to wrap the component. It builds fine now.
Hi,
This pull request doesn't correctly solve all of the given test use cases.
There has been a new update. Version 2.4.0
will support SSR.
$ npm install react-paypal-button-v2@2.4.0 --save
or
$ yarn add react-paypal-button-v2@2.4.0
If the component renders on the server, the old code evals
!isSdkReady
, finds it to betrue
and then because of the&&
it also has to check ifwindow.paypal
is true. That fails becausewindow
is undefined on the server. Switching to an||
means that as soon as!isSdkReady
evaluates to true, it doesn't need to evaluation the rest of the statement andnull
is returned.