Skip to content

Error: Cannot call a class as a function #2

Description

@ykmargate

When I'm trying to use the code listed below I'm getting error:
Uncaught TypeError: Cannot call a class as a function

import React, { PropTypes } from 'react';
import Confirm from 'react-bootstrap-confirm';

class myComponent extends React.Component {
    componentDidMount() {

       this.refs.confirm
        .show('are you sure?')
        .then(() => {
            //after sure
        })
        .catch(() => {
            //after cancel
        })
    }
    render() {

        return (
            <div>
        <Confirm.Component ref="confirm" title="Tips" sure="Sure" cancel="Cancel" />                
            </div>
        );
    }
}

export default myComponent;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions