This commit is contained in:
parent
0538487c03
commit
59fba729a2
|
@ -60,3 +60,23 @@ export class Layout extends React.Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class Form extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<form method="POST" action="/">
|
||||
<p>
|
||||
<input
|
||||
type="text"
|
||||
name="name"
|
||||
placeholder="Newsletter Name…"
|
||||
maxLength={500}
|
||||
size={30}
|
||||
required
|
||||
/>
|
||||
<button>Create Inbox</button>
|
||||
</p>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
import express from "express";
|
||||
import React from "react";
|
||||
import ReactDOMServer from "react-dom/server";
|
||||
import { Layout } from "./components";
|
||||
import { Layout, Form } from "./components";
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(express.static("static"));
|
||||
|
||||
app.get("/", (req, res) =>
|
||||
res.send(ReactDOMServer.renderToStaticMarkup(<Layout>Hello World</Layout>))
|
||||
res.send(
|
||||
ReactDOMServer.renderToStaticMarkup(
|
||||
<Layout>
|
||||
<Form></Form>
|
||||
</Layout>
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
app.listen(4000);
|
||||
|
|
Loading…
Reference in New Issue