Skip to content

× Error: Invalid hook call. #5

Open
@dylannirvana

Description

@dylannirvana

Trying to bring Convertkit form into a React application. Directly using the JavaScript embed provided by CK <script async data-uid="e9274113f5" src="https://astounding-creator-7935.ck.page/e9274113f5/index.js"></script> does not work as-is in React. Using convertkit-react, the connection is made but the template is not being brought in. I am getting: Error: Invalid hook call.

The example usage does not show the code in relation to the render() function.

This is the standalone form https://astounding-creator-7935.ck.page/e9274113f5

import Container from 'react-bootstrap/Container'
import ConvertKitForm from 'convertkit-react'

const MY_FORM_ID = 2248904
class Convertkit extends React.Component {   

      render() {  
        const config = {
            formId: MY_FORM_ID,
            template: 'cocoa',
            // emailPlaceholder: 'Enter an email address',
            // submitText: 'Sign up',
          }
          
          return (
                <Container className="section">
                    <p>Yo</p>
                    <ConvertKitForm {...config} />

                </Container>                                  
        )
    }
}

export default Convertkit;```

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions