Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComponentClass prop should be able to accept an actual component class #122

Open
jaydenseric opened this issue Oct 16, 2018 · 2 comments
Open

Comments

@jaydenseric
Copy link

Currently propTypes only allows a string for the ComponentClass prop:

ComponentClass: PropTypes.string,

It should be able to accept an actual component class (or function), to avoid the extra span DOM node:

import StripeCheckout from 'react-stripe-checkout'

const Button = ({ children, ...props }) => (
  <button {...props}>{children}</button>
)

class TakeMoney extends Component {
  onToken = token => console.log(token)

  render() {
    return (
      <StripeCheckout
        stripeKey={process.env.STRIPE_KEY}
        token={this.onToken}
        ComponentClass={Button}
      >
        New payment source
      </StripeCheckout>
    )
  }
}

The above works, but triggers a propTypes warning in a dev environment.

@Valentin1918
Copy link

What about this issue?

@Jarvl
Copy link

Jarvl commented Apr 3, 2019

Any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants