How to use the haunted.useState function in haunted

To help you get started, we’ve selected a few haunted examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kjartanm / microfrontends / packages / login / src / index.js View on Github external
function LoginFE() {
    const [customerid, setUserid] = useState(null);
    useEffect(() => {
        import('./kernel').then((Module) => {
            Module.onKernelKey('change:customerid', _customerid => {
                setUserid(_customerid);
            });
            setUserid(Module.getSharedKernel('customerid'));
        })
      }, []);    

    const update = (newState) => {
        import('./kernel').then((Module) => {
            Module.updateSharedKernel(newState);
        })
    }    
    return html`
    <section class="wc-module"></section>

haunted

Hooks for web components

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis