Skip to content
Snippets Groups Projects
app.tsx 563 B
Newer Older
  • Learn to ignore specific revisions
  • import React, { useState } from "react";
    
    import ReactDOM from "react-dom/client";
    
    import { Button } from "./components";
    
    import "./app.css";
    
    export const App = () => {
    
        const [count, setCount] = useState(0);
        const getText = () => `Hello World ${count}`;
        const onClick = () => setCount(count + 1);
        return <Button text={getText()} onClick={onClick} />;
    
    
    export const startApp = (element: string) => {
        const root = ReactDOM.createRoot(document.getElementById(element)!);
        root.render(<App />);
    
    
    export default App;