GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dy/unhook: Unscoped hooks

This repository was archived by the owner on Feb 18, 2023. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
index.js
index.js
 
 
license.md
license.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
readme.md
readme.md
 
 
test.html
test.html
 
 
test.js
test.js
 
 

Repository files navigation

unhook Build Status experimental

Unleash react/preact hooks from components, make them available in regular javascript without hooks limitations.

NPM

import { useEffect, useState } from 'unhook'

function tick() {
  let [count, setCount] = useState(0)

  useEffect(() => {
    let id = setInterval(() => {
      setCount(count => count + 1)

      // NOTE: function must be triggered manually
      tick()
    }, 1000)
    return () => clearInterval(id)
  }, [])
}

Internally, unhook uses error.stack, which is non-standard, but well supported by all browsers/engines for a long time.

For production, it is possible to statically compile source to avoid using error.stack. (pending feature...)

See also

  • enhook - turn a function into hooks-enabled function.
  • any-hooks - obtain any installed hooks.
  • unihooks - collection of universal hooks

HK

About

Unscoped hooks

Topics

unihooks

Resources

Readme
Activity

Stars

6 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.