Skip to content

Commit

Permalink
chore: Update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Oct 16, 2023
1 parent 5972ea5 commit ecf649e
Show file tree
Hide file tree
Showing 5 changed files with 335 additions and 2,180 deletions.
1 change: 0 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
10 changes: 7 additions & 3 deletions demo/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { render } from "preact";
import { hydrate, prerender as ssr } from "preact-iso";
import "./index.css";
import { Foo } from "./Foo";
import { ReactComponent } from "./Compat";

function App() {
return (
<div>
<div id="app">
<h1>Hello from Preact</h1>
<Foo />
<h2>Compat</h2>
Expand All @@ -14,4 +14,8 @@ function App() {
);
}

render(<App />, document.getElementById("app")!);
hydrate(<App />);

export async function prerender() {
return await ssr(<App />);
}
2 changes: 1 addition & 1 deletion demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import preact from "../src/index";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [preact()],
plugins: [preact({ prerender: { enabled: true } })],
});
Loading

0 comments on commit ecf649e

Please sign in to comment.