Swiftpack.co - Package -

HyperHooks Core

HypeHooks is React Hooks and HyperScript.

Use this Core component together with HyperHooks DOM to build Web applications.

Or use HyperSwift to create native SwiftUI applications with javascript.

Quick start with HyperHooks DOM

Import both hyperhooks-core and hyperhooks-dom scripts either locally or from CDN like so:

<script crossorigin src="https://cdn.jsdelivr.net/gh/hyperhooks/core@latest/hyperhooks-core.min.js"></script>
<script crossorigin src="https://cdn.jsdelivr.net/gh/hyperhooks/dom@latest/hyperhooks-dom.min.js"></script>

Then add the following snippet to your JavaScript entry point:

// Define our app
let App = () => {
  const [count, setCount] = useState(0)

  return h(Div, {},
    `Total bananas: ${count}`,
     h(Button, { onClick: () => { setCount(count + 1) } }, 'Add one 🍌!'),
  )
}

// Render our app into the document
render(h(App), document.querySelector('#app'))

Feel free to tweak and experiment with the code above.

Documentation

Head over to the main site for a more detailed introduction plus documentation.

Github

link
Stars:
Help us keep the lights on

Dependencies

Used By

Total: 0