From 85f76e2f20f484b3a76036b793a533824aa4637f Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Sat, 16 Oct 2021 19:54:50 -0600 Subject: [PATCH] Checking in experiment --- examples/uhtml-isomorphic/package.json | 12 +++++++++ examples/uhtml-isomorphic/src/page.uhtml.js | 30 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 examples/uhtml-isomorphic/package.json create mode 100644 examples/uhtml-isomorphic/src/page.uhtml.js diff --git a/examples/uhtml-isomorphic/package.json b/examples/uhtml-isomorphic/package.json new file mode 100644 index 00000000..03f64640 --- /dev/null +++ b/examples/uhtml-isomorphic/package.json @@ -0,0 +1,12 @@ +{ + "name": "uhtml-isomorphic", + "version": "0.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "Bret Comnes (https://bret.io/)", + "license": "MIT" +} diff --git a/examples/uhtml-isomorphic/src/page.uhtml.js b/examples/uhtml-isomorphic/src/page.uhtml.js new file mode 100644 index 00000000..a496d148 --- /dev/null +++ b/examples/uhtml-isomorphic/src/page.uhtml.js @@ -0,0 +1,30 @@ +import { html, useState, useEffect } from 'uland-isomorphic' + +export default async function ulandIsomorphicPage ({ + siteName, + title +}) { + const [state, setState] = useState() + + useEffect(() => { + setState('hydrated') + + return () => { + setState('unmounted') + } + }) + + return html` +
+ This page should act as a static page build src, but also the client bundle. +
+ +
+ state: ${state} +
+ ` +} + +export const vars = { + title: 'JS Page' +}