TS error: 'StripeProvider' cannot be used as a JSX componen
See original GitHub issueDescribe the bug
Typescript error when using <StripeProvider>
component
TS2786: 'StripeProvider' cannot be used as a JSX component. Its return type 'ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => Component<any, any, any>)> | ReactElement<any, string | ... 1 more ... | (new (props: any) => Component<...>)>[]' is not a valid JSX element. Type 'ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => Component<any, any, any>)>[]' is missing the following properties from type 'Element': type, props, key
To Reproduce
Add a basic <StripeProvider publishableKey={...} merchantIdentifier={...}>
component to App.
Expected behavior No typescript errors.
Additional context Library version: 0.2.3 This bug was not present on previous version 0.2.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Component cannot be used as a JSX component. Its return ...
I'm currently getting the following error on the Todos component inside TodoApp.tsx : 'Todos' cannot be used as a JSX component.
Read more >@stripe/stripe-react-native
Defined in src/components/StripeProvider.tsx:29 ... An optional object that contains data related to the payment method used to confirm this payment.
Read more >'errormessage' cannot be used as a jsx component. - You.com
Only ReactPaginage and Formik ErrorMessage components give this error. windows 11; Node v16.14.2; vs code 1.66.1; react 17.0.2; typescript 4.6.3. enter image ...
Read more >React Stripe.js reference | Stripe Documentation
Once the stripe prop has been set, these options can't be changed. If you want to use Payment Element, it is required to...
Read more >Stripe React Native SDK - npm
Start using @stripe/stripe-react-native in your project by running ... Stripe in your React Native app, use the StripeProvider component in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there an ETA on a new release?
In the meantime, this is what I came up with to avoid patching
node_modules
:Changing the return type to
React.ReactElement
seems to work for me