This commit is contained in:
Leandro Facchinetti 2020-03-18 00:49:41 -04:00
parent 0538487c03
commit 59fba729a2
2 changed files with 28 additions and 2 deletions

View File

@ -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>
);
}
}

View File

@ -1,14 +1,20 @@
import express from "express"; import express from "express";
import React from "react"; import React from "react";
import ReactDOMServer from "react-dom/server"; import ReactDOMServer from "react-dom/server";
import { Layout } from "./components"; import { Layout, Form } from "./components";
const app = express(); const app = express();
app.use(express.static("static")); app.use(express.static("static"));
app.get("/", (req, res) => app.get("/", (req, res) =>
res.send(ReactDOMServer.renderToStaticMarkup(<Layout>Hello World</Layout>)) res.send(
ReactDOMServer.renderToStaticMarkup(
<Layout>
<Form></Form>
</Layout>
)
)
); );
app.listen(4000); app.listen(4000);