simplified example

master
Atul R 5 years ago
parent 723114261d
commit 491eb65025
  1. 18
      src/index.tsx

@ -1,19 +1,17 @@
import { Renderer, View, Text, Button, Window } from "@nodegui/react-desktop";
import React, { useState, useMemo } from "react";
import { QPushButtonEvents } from "@nodegui/nodegui";
import React, { useState } from "react";
const App = () => {
const [time, setTime] = useState(`${new Date()}`);
const buttonEventHandlers = useMemo(
() => ({
[QPushButtonEvents.clicked]: () => setTime(`${new Date()}`)
}),
[]
);
return (
<Window styleSheet={styleSheet}>
<Window minSize={{ width: 500, height: 200 }} styleSheet={styleSheet}>
<View id="container">
<Button text="Update Time" on={buttonEventHandlers} />
<Button
text="Update Time"
on={{
clicked: () => setTime(`${new Date()}`)
}}
/>
<Text id="result">{time}</Text>
</View>
</Window>

Loading…
Cancel
Save