Skip to content

Ruben-Arushanyan/base-classes

Repository files navigation

You can find the full documentation on the website.

Description

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

Installation

npm install base-classes

The Store is a base class that provides the necessary methods and attributes to organize state management efficiently and easily.

Import

import {Store} from 'base-classes'
const {Store} = require('base-classes')

Basic Usage

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}
})


Read our contributing guide to learn about our development process.

This project has adopted the Contributor Covenant as its Code of Conduct, and we expect project participants to adhere to it. Please read the full text so that you can understand what actions will and will not be tolerated.

Authors

License

MIT License