I want to use the latest stripe sdk @stripe/stripe-react-native in older react native project based in class component ?
The doc stripe use the hooks,there is no example that used class component,So need help and thanks.
Question posted in React native
The official React Native documentation can be found here.
The official React Native documentation can be found here.
2
Answers
Yes,I found the solution such as wrap code with stripe provider or use initstripe both direcly from module thanks for your reply .
All of the stripe functions can be imported directly from
@stripe/stripe-react-native
so that you can use them both withclass
andfunctional
components.However, you are also able to access them via dedicated
hooks
.For instance you can use
useConfirmPayment
hook which apart fromconfirmPayment
method provides alsoloading
state so you don’t need to handle it manually.Moreover, there is also the main
useStripe
hook which provides all of the stripe methods.examples:
1.
Source: https://github.com/stripe/stripe-react-native/blob/master/docs/tipsi-stripe-migration-guide.md#class-vs-functional-components