Preactを使ったUserScriptをテスト
2021-05-08 16:01:36 成功した!
code:js
import('/api/code/takker/Preactを使ったUserScriptをテスト/script.js');
code:script.js
import {html, render} from '../htm@3.0.4%2Fpreact/script.js';
import {useState} from '../preact@10.5.13/hooks.js';
const Counter = () => {
return html<h1 class="preact-component" onClick=${() => setCounter(counter+1)}>${counter}</h1>;
};
document.head.insertAdjacentHTML('beforeend', `<style>
.preact-component {
position: fixed;
left: 0;
bottom: 0;
z-index: 9999;
}
</style>`);
console.log(html<${Counter} />);
render(html<${Counter} />, document.body);