
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
compostate-element
Advanced tools
Web Components bindings for compostate
npm install --save compostate compostate-element
yarn add compostate compostate-element
pnpm add compostate compostate-element
import { ref, effect } from 'compostate';
import { setRenderer, define } from 'compostate-element';
import { render, html } from 'lit-html';
// Setup the element's renderer using Lit
// Any renderer should work
setRenderer((root, result) => {
render(result, root);
});
// Define an element
define({
// Name of the element (required)
name: 'counter-title',
// Props to be tracked (required)
props: ['value'],
// Element setup
setup(props) {
// The setup method is run only once
// it's useful to setup your component logic here.
effect(() => {
// Props are reactive
console.log(`Current count: ${props.value}`);
});
// Return the template atom
// The template's returned value depends
// on the renderer's templates.
// For example, you can return a JSX markup
// if the renderer used is React or Preact.
return () => (
html`
<h1>Count: ${props.value}</h1>
`
);
},
});
define({
name: 'counter-button',
setup() {
const count = ref(0);
function increment() {
count.value += 1;
}
function decrement() {
count.value -= 1;
}
return () => (
html`
<button @click=${increment}>Increment</button>
<button @click=${decrement}>Decrement</button>
<counter-title value="${count.value}"></counter-title>
`
);
},
});
MIT © lxsmnsyc
FAQs
compostate + Custom Elements
We found that compostate-element demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.