
Security News
Security Community Slams MIT-linked Report Claiming AI Powers 80% of Ransomware
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.
@containrz/stencil-decorator
Advanced tools
`@containrz/stencil-decorator` is a simpe decorator to help you manage your global and local states without any need for configuration and no dependency on context.
@containrz/stencil-decorator is a simpe decorator to help you manage your global and local states without any need for configuration and no dependency on context.
In order to use @containrz/stencil-decorator, you need to create a class that extends Container, provided on the package.
import { Container } from '@containrz/stencil-decorator'
interface User {
  name: string
  email: string
  phoneNumber: string
}
export class UserContainer extends Container<User> {
  public state = {
    name: '',
    email: '',
    phoneNumber: '',
  }
  public setUser = (user: User) => this.setState(user)
  public setName = (name) => this.setState({ name })
  public setEmail = (email) => this.setState({ email })
  // ...
}
Once you have your container, you can now start sharing its state:
import { Component, VNode } from '@stencil/core'
import { UseContainer } from '@containrz/stencil-decorator'
import { UserContainer } from './UserContainer'
@Component({
  tag: 'my-component',
  styleUrl: 'my-component.css',
  shadow: true,
})
export class MyComponent {
  @UseContainer(UserContainer) userData: UserContainer
  render(): VNode {
    return (
      <div>
        <input
          value={this.userData.state.name}
          onChange={e => this.userData.setName(e.target.value)}
        />
        <p>{this.userData.state.name}</p>
      </div>
    )
  }
}
In case you need to create a container based on a prop, you can also register it in a different way:
import { Component, VNode } from '@stencil/core'
import { registerContainer } from '@containrz/stencil-decorator'
import { UserContainer } from './UserContainer'
@Component({
  tag: 'my-component',
  styleUrl: 'my-component.css',
  shadow: true,
})
export class MyComponent {
  @Prop() userId: string
  private userData: UserContainer
  componentWillLoad(): void {
    this.test = registerContainer(new UserContainer(this.userId), this)
  }
  render(): VNode {
    return (
      <div>
        <input
          value={this.userData.state.name}
          onChange={e => this.userData.setName(e.target.value)}
        />
        <p>{this.userData.state.name}</p>
      </div>
    )
  }
}
FAQs
`@containrz/stencil-decorator` is a simpe decorator to help you manage your global and local states without any need for configuration and no dependency on context.
We found that @containrz/stencil-decorator 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
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.