mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## Description This PR ensures that the default prettier config is used for examples and templates. This config is compatible with `prettier@3` as well (upgrading prettier is bigger change that can be a future PR). ## Changes - Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will be needed upgrading to prettier@3) - Added `examples/.prettierrc.json` with default config (this will change every example) - Added `packages/create-next-app/templates/.prettierrc.json` with default config (this will change every template) ## Related - Fixes #54402 - Closes #54409
47 lines
930 B
JavaScript
47 lines
930 B
JavaScript
import { useState, useEffect } from "react";
|
|
|
|
const Home = () => {
|
|
const [input, setInput] = useState("");
|
|
const [message, setMessage] = useState(null);
|
|
|
|
useEffect(() => {
|
|
const handleMessage = (event, message) => setMessage(message);
|
|
window.electron.message.on(handleMessage);
|
|
|
|
return () => {
|
|
window.electron.message.off(handleMessage);
|
|
};
|
|
}, []);
|
|
|
|
const handleSubmit = (event) => {
|
|
event.preventDefault();
|
|
window.electron.message.send(input);
|
|
setMessage(null);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<h1>Hello Electron!</h1>
|
|
|
|
{message && <p>{message}</p>}
|
|
|
|
<form onSubmit={handleSubmit}>
|
|
<input
|
|
type="text"
|
|
value={input}
|
|
onChange={(e) => setInput(e.target.value)}
|
|
/>
|
|
</form>
|
|
|
|
<style jsx>{`
|
|
h1 {
|
|
color: red;
|
|
font-size: 50px;
|
|
}
|
|
`}</style>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Home;
|