-
Notifications
You must be signed in to change notification settings - Fork 31
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
Trouble getting the plugin to work #59
Comments
hi @reinhal ... your question is a bit outside the scope of this plugin because even if you remove the plugin code, i think you may still have issues with it? if that's truly the code you have on the page, you'll notice that the i highly recommend following the tutorial on gatsby. once you get a basic starter working, you can then add additional plugins, like this one. :) good luck! |
thanks @benjaminhoffman. I get it. I see that I was too much in a rush and my html code did not completely paste. I am wondering if there is an issue on the mailchimp side. But, I am calling both functions. Here is the code again, I had to remove the open and close tags on everything for it to show: `import React from 'react' export default class JoinNewsletter extends React.Component { _handleChange = e => { _handleSumbit = e => { |
I have set up the code and configured the plugin in the gatsby-config.js file, but when I click submit the form, I do not get any of the console.log that I expect to see.
Any ideas on what I am missing?
`import React from 'react'
import addToMailchimp from 'gatsby-plugin-mailchimp'
export default class JoinNewsletter extends React.Component {
state = {
email: null,
firstName: null,
lastName: null,
}
_handleChange = e => {
console.log({ [
${e.target.name}
]: e.target.value });this.setState({
[
${e.target.firstName}
]: e.target.value,})
}
_handleSumbit = e => {
e.preventDefault();
console.log('submit', this.state)
addToMailchimp(this.state.email, {firstName: this.state.firstName, lastName: this.state.lastName})
.then(({msg, result}) => {
console.log('msg',
${result}: ${msg}
);if(result !== 'success') {
throw msg;
}
})
.catch(err => {
console.log('err', err);
alert(err);
});
}
render() {
return (
First Name
Last Name
Email
);
}
}`
The text was updated successfully, but these errors were encountered: