mercredi 27 novembre 2019

Hoc semantic-ui Popup

I'm trying to create HOC function that wrap any component with semantic Popup. I have a function 'withCopy' that returns React.Component. This code doesnt work. Ite returns Wrapped component without Popup and CopyToClipboard. This is my code:

export const withCopy = (WrappedComponent: any, content: string) => {
    return class extends React.Component {
        render() {
            return <Popup
                trigger={
                    <CopyToClipboard text={content}>
                        <WrappedComponent />
                    </CopyToClipboard>
                }
                content="Copy to clipboard"
                position='bottom center'
            />
        }
    }
}

Any help?

Aucun commentaire:

Enregistrer un commentaire