Swiftpack.co - Package - hyperhooks/core

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: 0

Dependencies

Used By

Total: 0

Releases

SPM release - 2019-09-24 16:25:22

This release features compatibility with Swift Package Manager (SPM)

Initial release - 2019-09-24 13:34:36

Initial release features:

  • h() HyperScript function to compose virtual DOM elements
  • use*() library of React Hooks for component behavior
  • makeRender() for external render engine support