Skip to content

Commit 369f796

Browse files
committed
Merge branch 'master' into develop
2 parents 4cc5543 + 561421a commit 369f796

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

src/pages/index.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import React, { useState } from 'react';
2+
3+
import Layout from '../components/layout';
4+
import SEO from '../components/seo';
5+
6+
const IndexPage = () => {
7+
const [email, setEmail] = useState('');
8+
9+
const handleSubmit = async e => {
10+
e.preventDefault();
11+
const emails = [{ email }];
12+
const response = await fetch('/.netlify/functions/submitEmailAddress', {
13+
body: JSON.stringify(emails),
14+
method: 'post',
15+
});
16+
17+
const body = await response.json();
18+
if (!body.error_count) {
19+
setEmail('');
20+
}
21+
};
22+
23+
return (
24+
<Layout>
25+
<SEO title="Home" keywords={[`gatsby`, `application`, `react`]} />
26+
<h1>Hi people</h1>
27+
<p>Coming soon: React and TypeScript documentation!</p>
28+
<form method="post" onSubmit={handleSubmit}>
29+
<label>
30+
Want an email when it's ready? Join my mailing list!
31+
<br />
32+
<input
33+
type="email"
34+
value={email}
35+
onChange={e => setEmail(e.target.value)}
36+
placeholder="email"
37+
required
38+
/>
39+
<button type="submit">Submit</button>
40+
</label>
41+
</form>
42+
<p>
43+
Visit the{' '}
44+
<a
45+
href="https://github.com/AryanJ-NYC/reactandtypescript.dev"
46+
target="_blank"
47+
rel="noopener noreferrer"
48+
>
49+
GitHub repository
50+
</a>{' '}
51+
to contribute!
52+
</p>
53+
<p>
54+
If you're looking for immediate React and TypeScript help, please visit{' '}
55+
<a
56+
href="https://twitter.com/swyx"
57+
target="_blank"
58+
rel="noopener noreferrer"
59+
>
60+
@swyx
61+
</a>
62+
's{' '}
63+
<a
64+
href="https://github.com/sw-yx/react-typescript-cheatsheet"
65+
target="_blank"
66+
rel="noopener noreferrer"
67+
>
68+
React TypeScript cheatsheet.
69+
</a>
70+
</p>
71+
<p>
72+
Lastly, tweet me at{' '}
73+
<a
74+
href="https://twitter.com/AryanJabbari"
75+
target="_blank"
76+
rel="noopener noreferrer"
77+
>
78+
@AryanJabbari
79+
</a>
80+
. Words of encouragement are always welcome!
81+
</p>
82+
</Layout>
83+
);
84+
};
85+
86+
export default IndexPage;

0 commit comments

Comments
 (0)