md84419

jsx-demo.jsx

Sep 13th, 2025
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { createRoot, useState } from '../src/jsx-runtime';
  2.  
  3. function App() {
  4.   const [count, setCount] = useState(0);
  5.   const [name, setName] = useState('');
  6.   const [volume, setVolume] = useState(0.5);
  7.   const [enabled, setEnabled] = useState(false);
  8.  
  9.   // const App = MyApp;
  10.   const Body = "Body";
  11.   const Window = "Window";
  12.   const Text = "Text";
  13.   const Button = "Button";
  14.   const SameLine = "SameLine";
  15.   const Checkbox = "Checkbox";
  16.   const InputText = "InputText";
  17.   const SliderFloat = "SliderFloat";
  18.  
  19.   return (
  20.     <App>
  21.       <Body>
  22.         <Window title="JSX ImGui Demo">
  23.           <Text>Welcome to JSX ImGui!</Text>
  24.           <Text>Count: {count}</Text>
  25.           <Button onClick={() => setCount(count + 1)}>
  26.             Clicked {count} times
  27.           </Button>
  28.           <SameLine />
  29.           <Checkbox
  30.             label="Enable Feature"
  31.             checked={enabled}
  32.             onChange={setEnabled}
  33.           />
  34.           <InputText
  35.             label="Name"
  36.             hint="Enter your name"
  37.             value={name}
  38.             onChange={setName}
  39.           />
  40.           <SliderFloat
  41.             label="Volume"
  42.             min={0}
  43.             max={1}
  44.             value={volume}
  45.             onChange={setVolume}
  46.           />
  47.         </Window>
  48.       </Body>
  49.     </App>
  50.   );
  51. }
  52.  
  53. // var App = MyApp;
  54. export default App;
Advertisement
Add Comment
Please, Sign In to add comment