Skip to main content

JavaScript Base Classes

Useful JavaScript base classes for efficient and quick solutions to common problems.

Installation

npm install base-classes

Simple Usage Example

import {Store} from 'base-classes'

class MyClass extends Store {
state = { count: 1 }
}

const myClass = new MyClass()

myClass.subscribe((state, prevState) => {
console.log('state changed:', state)
})
myClass.updateState((state) => {
return {...state, count: 2}
})