Evit packages documentation
    Preparing search index...

    Evit packages documentation

    evit

    A lightweight, type-safe, stateless event system for building reactive UIs. Designed to enable feature-level communication in large-scale applications using frameworks like React.

    evit = event it!


    • Fully type-safe payloads and event tags
    • Zero re-renders — events are just callbacks, not state
    • Built for cross-feature communication
    • Framework-agnostic core (@evit/core)
    • Optional React bindings via @evit/react
    • No external dependencies

    Core library:

    npm install @evit/core
    
    pnpm add @evit/core
    
    yarn add @evit/core
    

    React bindings:

    You can also install react bindings @evit/react.


    import { defineEvent, withPayload } from '@evit/core'

    // Define an event with a payload
    const userCreated = defineEvent('user.created', withPayload<{ id: number }>())

    // Subscribe to the event
    userCreated.on((payload, tag) => {
    console.log(payload.id) // → 123
    })

    // Trigger the event
    userCreated({ id: 123 })

    • Decoupled communication between features, widgets, or UI layers
    • Declarative side-effect triggers (e.g. analytics, logging, DOM focus)
    • Ideal for Feature-Sliced Design or modular frontend architectures
    • Works alongside any state management — or none at all

    Package Description
    @evit/core Framework-agnostic core event system
    @evit/react React bindings (useEventEffect hook, etc.)

    MIT