mirror of
https://github.com/leon-ai/leon.git
synced 2024-11-28 12:43:35 +03:00
feat(web app): set up React
This commit is contained in:
parent
96145bb2f7
commit
7a31158497
@ -9,6 +9,7 @@
|
||||
</head>
|
||||
<body class="settingup">
|
||||
<main>
|
||||
<div id="root"></div>
|
||||
<div id="feed">
|
||||
<p id="no-bubble" class="hide">
|
||||
You can start to interact with Leon, don't be shy.
|
||||
@ -48,5 +49,6 @@
|
||||
</div>
|
||||
</footer>
|
||||
<script type="module" src="/js/main.js"></script>
|
||||
<script type="module" src="/js/test.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
14
app/src/js/app.tsx
Normal file
14
app/src/js/app.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
import { useState } from 'react'
|
||||
|
||||
function App() {
|
||||
const [count, setCount] = useState(0)
|
||||
|
||||
return (
|
||||
<>
|
||||
<button onClick={() => setCount(count + 1)}>Click me</button>
|
||||
<p>hello from React. Count: {count}</p>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
10
app/src/js/test.tsx
Normal file
10
app/src/js/test.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
|
||||
import App from './app.tsx'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
)
|
19
app/tsconfig.json
Normal file
19
app/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"useDefineForClassFields": true,
|
||||
"skipLibCheck": true,
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user