🎯
Type-Safe by Default
Full TypeScript inference from your state type through the hook return value. No manual type annotations needed.
Type-safe state management for React with automatic re-render optimization
import { Cubit } from '@blac/core';
import { useBloc } from '@blac/react';
// 1. Define your state in a class
class CounterCubit extends Cubit<{ count: number }> {
constructor() {
super({ count: 0 });
}
increment = () => this.emit({ count: this.state.count + 1 });
}
// 2. Use it in any component — state is shared automatically
function Counter() {
const [state, counter] = useBloc(CounterCubit);
return <button onClick={counter.increment}>{state.count}</button>;
}pnpm add @blac/core @blac/reactnpm install @blac/core @blac/reactyarn add @blac/core @blac/react