Comments (2)
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 _handleChange
and _handleSubmit
functions never get called. you need to create html input fields and attach those methods to the fields.
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!
from gatsby-plugin-mailchimp.
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'
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 (
div
form onSubmit={this._handleSubmit}
div
label First Name label
div
input type="text" onChange={this._handleChange} placeholder="first name" name="firstName"
div
div
div
label Last Name label
div
input type="text" onChange={this._handleChange} placeholder="last name" name="lastName"
div>
div
div
label Email label
div
input type="email" onChange={this._handleChange} placeholder="email" name="email"
div
div
div
input type="submit"
div
form
div
);
}
}`
from gatsby-plugin-mailchimp.
Related Issues (20)
- How to set a tag when calling addToMailchimp
- error Multiple "root" queries found in examples/gatsby-v1/src/layouts/index.js HOT 1
- Use timeout based on plugin options HOT 3
- How can I display success message? HOT 2
- v1 branch missing HOT 4
- List is GONE HOT 4
- How to secure the Mailchimp's POST URL? HOT 2
- Cant install latest version HOT 2
- gatsby build gives error || "Mailchimp endpoint required and must be of type string. " HOT 10
- Address parameters are capitalized in request to mailchimp HOT 2
- Is there a way to change the return promise message? HOT 2
- GDPR Fields HOT 3
- failure to add to list with no error HOT 1
- Build failed HOT 1
- Please enter a value HOT 1
- How to add predefined tags from Mailchimp HOT 1
- Email Not Triggered HOT 1
- Can this be used with Mailchimp's Contact Form / Inbox? HOT 4
- can't locate the addToMailChimp function on import HOT 1
- No error message being received on duplicate signup
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-plugin-mailchimp.