1.0.2 • Published 4 months ago

dom-state v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

DOM-state

Simple library for managing state with a data-attributes.

npm install dom-state

How to use

import { useDomState } from 'dom-state';

const [getState, setState] = useDomState(element, 0);

button.addEventListener('click', () => {
  setState(
    (prev) => prev + 1, // or direct value
    (newState) => `counter: ${newState}`,
  );
});

For more details check source code

How to contribute

If you want to add something, or fix a bug create an issue/PR here, I make sure to check it out.

PS

This is fun project, inspired by article, so use in production at your own risk :)

1.0.2

4 months ago

0.0.1

9 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.0.0

2 years ago