Last active
July 31, 2020 12:58
-
-
Save fmacedoo/5b6687e4e150152caaa61e894440368b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import sendAsync from './message-control/renderer'; | |
import './App.css'; | |
function App() { | |
const [message, setMessage] = useState('SELECT * FROM repositories'); | |
const [response, setResponse] = useState(); | |
function send(sql) { | |
sendAsync(sql).then((result) => setResponse(result)); | |
} | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<h1> | |
Standalone application with Electron, React, and | |
SQLite stack. | |
</h1> | |
</header> | |
<article> | |
<p> | |
Say <i>ping</i> to the main process. | |
</p> | |
<input | |
type="text" | |
value={message} | |
onChange={({ target: { value } }) => setMessage(value)} | |
/> | |
<button type="button" onClick={() => send(message)}> | |
Send | |
</button> | |
<br /> | |
<p>Main process responses:</p> | |
<br /> | |
<pre> | |
{(response && JSON.stringify(response, null, 2)) || | |
'No query results yet!'} | |
</pre> | |
</article> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment